mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* gc.c (heap_set_increment): accept minumum additional page number.
* gc.c (gc_after_sweep): allocate pages to allocate at least RUBY_HEAP_MIN_SLOTS. [Bug #9137] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9d2f54b3e9
commit
c91ec25d19
2 changed files with 17 additions and 4 deletions
|
@ -1,3 +1,11 @@
|
|||
Fri Nov 22 16:25:43 2013 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* gc.c (heap_set_increment): accept minumum additional page number.
|
||||
|
||||
* gc.c (gc_after_sweep): allocate pages to allocate at least
|
||||
RUBY_HEAP_MIN_SLOTS.
|
||||
[Bug #9137]
|
||||
|
||||
Fri Nov 22 16:19:52 2013 Narihiro Nakamura <authornari@gmail.com>
|
||||
|
||||
* include/ruby/intern.h (rb_gc_set_params): Deprecate
|
||||
|
|
13
gc.c
13
gc.c
|
@ -1135,7 +1135,7 @@ heap_add_pages(rb_objspace_t *objspace, rb_heap_t *heap, size_t add)
|
|||
}
|
||||
|
||||
static void
|
||||
heap_set_increment(rb_objspace_t *objspace)
|
||||
heap_set_increment(rb_objspace_t *objspace, size_t minimum_limit)
|
||||
{
|
||||
size_t used = heap_pages_used - heap_tomb->used;
|
||||
size_t next_used_limit = (size_t)(used * gc_params.growth_factor);
|
||||
|
@ -1144,6 +1144,11 @@ heap_set_increment(rb_objspace_t *objspace)
|
|||
if (next_used_limit > max_used_limit) next_used_limit = max_used_limit;
|
||||
}
|
||||
if (next_used_limit == heap_pages_used) next_used_limit++;
|
||||
|
||||
if (next_used_limit < minimum_limit) {
|
||||
next_used_limit = minimum_limit;
|
||||
}
|
||||
|
||||
heap_pages_increment = next_used_limit - used;
|
||||
heap_pages_expand_sorted(objspace);
|
||||
|
||||
|
@ -2750,7 +2755,7 @@ gc_heap_prepare_minimum_pages(rb_objspace_t *objspace, rb_heap_t *heap)
|
|||
{
|
||||
if (!heap->free_pages) {
|
||||
/* there is no free after page_sweep() */
|
||||
heap_set_increment(objspace);
|
||||
heap_set_increment(objspace, 0);
|
||||
if (!heap_increment(objspace, heap)) { /* can't allocate additional free objects */
|
||||
during_gc = 0;
|
||||
rb_memerror();
|
||||
|
@ -2885,7 +2890,7 @@ gc_after_sweep(rb_objspace_t *objspace)
|
|||
(int)heap->limit, (int)heap_pages_swept_num, (int)heap_pages_min_free_slots);
|
||||
|
||||
if (heap_pages_swept_num < heap_pages_min_free_slots) {
|
||||
heap_set_increment(objspace);
|
||||
heap_set_increment(objspace, (heap_pages_min_free_slots - heap_pages_swept_num) / HEAP_OBJ_LIMIT);
|
||||
heap_increment(objspace, heap);
|
||||
|
||||
#if USE_RGENGC
|
||||
|
@ -4849,7 +4854,7 @@ heap_ready_to_gc(rb_objspace_t *objspace, rb_heap_t *heap)
|
|||
if (dont_gc || during_gc) {
|
||||
if (!heap->freelist && !heap->free_pages) {
|
||||
if (!heap_increment(objspace, heap)) {
|
||||
heap_set_increment(objspace);
|
||||
heap_set_increment(objspace, 0);
|
||||
heap_increment(objspace, heap);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue