diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-07-10 10:26:45 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-07-10 10:26:45 +0000 |
commit | 8fb441a7be054d9724426bfa03c4e4c178133395 (patch) | |
tree | 03b2ebca9b7a519c724aa9ecc8e6882db8d09332 /gc.c | |
parent | 4c5d28745b3f3f8b46ba78fa693c8da044b9835f (diff) | |
download | ruby-8fb441a7be054d9724426bfa03c4e4c178133395.tar.gz ruby-8fb441a7be054d9724426bfa03c4e4c178133395.tar.xz ruby-8fb441a7be054d9724426bfa03c4e4c178133395.zip |
* gc.c (gc_sweep): expand heap earlier.
reported by MORITA Naoyuki. [ruby-dev:28960]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@10507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -1056,6 +1056,14 @@ gc_sweep() int freed = 0; int i; unsigned long live = 0; + unsigned long free_min = 0; + + for (i = 0; i < heaps_used; i++) { + free_min += heaps[i].limit; + } + free_min = free_min * 0.2; + if (free_min < FREE_MIN) + free_min = FREE_MIN; if (ruby_in_compile && ruby_parser_stack_on_heap()) { /* should not reclaim nodes during compilation @@ -1111,7 +1119,7 @@ gc_sweep() } p++; } - if (n == heaps[i].limit && freed > FREE_MIN) { + if (n == heaps[i].limit && freed > free_min) { RVALUE *pp; heaps[i].limit = 0; @@ -1129,7 +1137,7 @@ gc_sweep() if (malloc_limit < GC_MALLOC_LIMIT) malloc_limit = GC_MALLOC_LIMIT; } malloc_increase = 0; - if (freed < FREE_MIN) { + if (freed < free_min) { add_heap(); } during_gc = 0; |