[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] the garbage collector is not doing its job

From: Derek Zhou
Subject: Re: [Help-smalltalk] the garbage collector is not doing its job
Date: Mon, 19 Jan 2009 00:01:40 -0800
User-agent: KMail/1.9.9

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]