This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch to bitmap_operation
- To: gcc-patches at gcc dot gnu dot org
- Subject: Patch to bitmap_operation
- From: Jason Merrill <jason at cygnus dot com>
- Date: Thu, 17 Feb 2000 12:23:40 -0800
This patch reduces memory consumption for one testcase from >120MB to 20MB.
2000-02-17 Jason Merrill <jason@casey.cygnus.com>
* bitmap.c (bitmap_operation): Don't leak bitmap elements.
Index: bitmap.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/bitmap.c,v
retrieving revision 1.19
diff -c -p -r1.19 bitmap.c
*** bitmap.c 2000/01/11 23:27:40 1.19
--- bitmap.c 2000/02/17 20:22:23
*************** bitmap_operation (to, from1, from2, oper
*** 477,483 ****
changed = 1;
to_tmp = to_ptr;
to_ptr = to_ptr->next;
! to_tmp = bitmap_free;
bitmap_free = to_tmp;
}
if (to_ptr && to_ptr->indx == indx)
--- 477,483 ----
changed = 1;
to_tmp = to_ptr;
to_ptr = to_ptr->next;
! to_tmp->next = bitmap_free;
bitmap_free = to_tmp;
}
if (to_ptr && to_ptr->indx == indx)
*************** bitmap_operation (to, from1, from2, oper
*** 516,521 ****
--- 516,526 ----
{
to_tmp->indx = indx;
bitmap_element_link (to, to_tmp);
+ }
+ else
+ {
+ to_tmp->next = bitmap_free;
+ bitmap_free = to_tmp;
}
}