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 | 6d67a688f2a4115654811945257177b75b29f94f (patch) | |
tree | 43d4a8399dc8783bb831a6815cb2aa63e83b173b /gc.c | |
parent | 203c2e18f50efd0323bd9236debea8daee8b5d13 (diff) | |
download | ruby-6d67a688f2a4115654811945257177b75b29f94f.tar.gz |
* gc.c (gc_sweep): expand heap earlier.
reported by MORITA Naoyuki. [ruby-dev:28960]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -1057,6 +1057,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) { @@ -1099,7 +1107,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; @@ -1117,7 +1125,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; |