diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-06-16 12:39:35 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-06-16 12:39:35 +0000 |
commit | c4d2965fb614480d477a4be52f80ec6d0eb20f3a (patch) | |
tree | 3419afd640af4a2e6171b70446a58752b4a7d297 /gc.c | |
parent | 8092d0bd873e9d3a5e12abbf778d9705d26b130a (diff) | |
download | ruby-c4d2965fb614480d477a4be52f80ec6d0eb20f3a.tar.gz |
* gc.c (gc_sweep): re-introduce heap extension strategy change.
[ruby-dev:31005]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -1109,6 +1109,14 @@ gc_sweep(void) 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; mark_source_filename(ruby_sourcefile); if (source_filenames) { @@ -1151,7 +1159,7 @@ gc_sweep(void) } p++; } - if (n == heaps[i].limit && freed > FREE_MIN) { + if (n == heaps[i].limit && freed > free_min) { RVALUE *pp; heaps[i].limit = 0; @@ -1169,7 +1177,7 @@ gc_sweep(void) 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; |