help-smalltalk
[Top][All Lists]
Advanced

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

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


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] the garbage collector is not doing its job
Date: Mon, 19 Jan 2009 09:34:02 +0100
User-agent: Thunderbird 2.0.0.19 (Macintosh/20081209)

Derek Zhou wrote:
> 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.

I actually applied this patch instead, but you must be thanked anyway
for the debugging.

diff --git a/libgst/oop.c b/libgst/oop.c
index fdfb4d2..db11c5a 100644
--- a/libgst/oop.c
+++ b/libgst/oop.c
@@ -1006,6 +1006,8 @@ _gst_compact (size_t new_heap_limit)
     }
   else
     {
+      /* Do not copy garbage.  */
+      _gst_finish_incremental_gc ();
       _gst_mem.numCompactions++;
       update_stats (&stats.timeOfLastCompaction, NULL, NULL);
     }
@@ -1063,7 +1065,6 @@ void
 _gst_global_compact ()
 {
   _gst_global_gc (0);
-  _gst_finish_incremental_gc ();
   _gst_compact (0);
 }


Paolo




reply via email to

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