help-smalltalk
[Top][All Lists]
Advanced

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

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


From: Derek Zhou
Subject: [Help-smalltalk] Re: the garbage collector is not doing its job
Date: Wed, 21 Jan 2009 20:21:37 -0800
User-agent: KMail/1.9.9

On Wednesday 21 January 2009 12:10:19 am you wrote:
> Yes, and I applied it. But the first one slows down the attached program
> by a factor of 10. :-(
I see the problem. One quick fix is not to let heap shrink too low by setting a 
low limit, such as the size eden. After I did that the reclaimedBytesPerGlobalGC
went back to the more reasonable 1~2M range and spead went back to normal.  
>
> I think you need a separate and more conservative knob for shrinking the
> heap, or maybe we just need to reevaluate your patch after fixing
> incremental GC.
>
> Paolo

--- orig/libgst/oop.c
+++ mod/libgst/oop.c
@@ -1120,12 +1121,25 @@
     {
       old_limit = MAX (old_limit, _gst_mem.old->heap_total);
 
-      /* Check if it's time to compact the heap.  */
+      /* if memory is still low, go all the way on sweeping */
       if UNCOMMON ((next_allocation + _gst_mem.old->heap_total)
            * 100.0 / old_limit > _gst_mem.grow_threshold_percent)
         {
-          s = "done, heap compacted";
-          _gst_compact (0);
+          int target_limit;
+          _gst_finish_incremental_gc ();
+
+      /* Check if it's time to compact the heap. Compaction make the most 
+         sense if there were lots of garbage. And the heap limit is shrunk 
+         to avoid excessive garbage accumulation in the next round */
+          target_limit = MAX(_gst_mem.eden.totalSize, (next_allocation + 
+              _gst_mem.old->heap_total) * (100.0 + _gst_mem.space_grow_rate) / 
+                              _gst_mem.grow_threshold_percent);
+          if UNCOMMON ( target_limit < old_limit)
+            {
+              s = "done, heap compacted";
+              _gst_compact (0);
+              grow_memory_no_compact (target_limit);
+            }
         }
 
       /* Check if it's time to grow the heap.  */




reply via email to

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