Patch to bitmap_operation

Jason Merrill jason@cygnus.com
Thu Feb 17 12:23:00 GMT 2000


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;
  	}
      }
  


More information about the Gcc-patches mailing list