On Saturday 17 January 2009 01:21:00 pm Derek Zhou wrote:
> So far the only ways I found to really reclaim memory are either
> "ObjectMemory compact" or back to back "ObjectMemory globalGarbageCollect";
> a
> single "globalGarbageCollect" won't do. Right now I work around the problem
> by sprinkle my code with "ObjectMemory compact" but that sounds silly,
> isn't it?
I debugged it a little and come up with a 2 lines patch that fix this memory 
leak. The idea is to always finish the sweep before the compacting; Otherwise 
you may be compacting a heap full of garbage. Worse, in my case I am 
producing garbage faster than the incremental sweeping can get to them so my 
heap just keep growing. Please apply.
 
--- smalltalk-3.0.5/libgst/oop.c        2008-10-19 04:48:40.000000000 -0700
+++ smalltalk-3.0.5_new/libgst/oop.c    2009-01-18 23:24:18.000000000 -0800
@@ -808,6 +808,7 @@
   if COMMON (p_instance)
     goto ok;
 
+  _gst_finish_incremental_gc ();
   _gst_compact (0);
   p_instance = (gst_object) _gst_mem_alloc (_gst_mem.old, size);
   if UNCOMMON (!p_instance)
@@ -1125,6 +1126,7 @@
            * 100.0 / old_limit > _gst_mem.grow_threshold_percent)
         {
           s = "done, heap compacted";
+          _gst_finish_incremental_gc ();
           _gst_compact (0);
         }
 


_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to