heap_pages_increment.
For example, GC by exceeding malloc_limit can remain
heap_pages_increment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
on RGENGC_AGE2_PROMOTION.
* gc.c (RVALUE_PROMOTE_YOUNG): decrement young object count on
YOUNG->OLD.
* gc.c (obj_free): decrement young object count when young object
freed.
* gc.c (gc_marks): should not clear young object count.
* gc.c (gc_stat_internal): GC.stat :young_object information.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Tomb heap pages are freed pages here, so expanding heap is
not required.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
when memop type is MEMOP_TYPE_REALLOC.
GC at realloc is not well maintained.
We need a time to make it safe.
[ruby-dev:48117]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (objspace_malloc_increase): run full mark if 0x04 bit is
set in ruby_gc_stress. [ruby-core:62103] [Feature #9761]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (objspace_malloc_increase): run GC after realloc not only
malloc and calloc by GC.stress. [ruby-core:62103] [Feature #9761]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (garbage_collect_body): name magic numbers.
* gc.c (gc_stress_set): GC.stress accepts not only boolean but
also Fixnum.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (rb_gc_writebarrier): drop special case for big hash/array
[Bug #9518]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c: no newline in messages for rb_bug, it outputs a newline
after the message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (gc_verify_internal_consistency): always do nothing unless
USE_RGENGC is set, no local variable needed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This reverts a hunk of r40703 by ko1.
This fixes [ruby-dev:48098] [Bug #9717].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (rgengc_rememberset_mark): don't promote, but remain in
remember set for infant objects.
* gc.c (RVALUE_PROMOTE_INFANT, RVALUE_PROMOTE_YOUNG): count numbers
in these functions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Add a new (hidden) C-API to iterate objspace snapshot.
This API is not safe to call any C-APIs in a given callback
function. Be careful to use this C-API.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (gc_info_decode): get rid of inadvertent dynamic symbol
pin-down, and preserve encoding in error messages. also should
not use RSTRING_PTR macro on function calls.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
See this ticket about Symbol GC.
* include/ruby/ruby.h:
Declare few functions.
* rb_sym2id: almost same as old SYM2ID but support dynamic symbols.
* rb_id2sym: almost same as old ID2SYM but support dynamic symbols.
* rb_sym2str: almost same as `rb_id2str(SYM2ID(sym))` but not
pin down a dynamic symbol.
Declare a new struct.
* struct RSymbol: represents a dynamic symbol as object in
Ruby's heaps.
Add few macros.
* STATIC_SYM_P: check a static symbol.
* DYNAMIC_SYM_P: check a dynamic symbol.
* RSYMBOL: cast to RSymbol
* gc.c: declare RSymbol. support T_SYMBOL.
* internal.h: Declare few functions.
* rb_gc_free_dsymbol: free up a dynamic symbol. GC call this
function at a sweep phase.
* rb_str_dynamic_intern: convert a string to a dynamic symbol.
* rb_check_id_without_pindown: not pinning function.
* rb_sym2id_without_pindown: ditto.
* rb_check_id_cstr_without_pindown: ditto.
* string.c (Init_String): String#intern and String#to_sym use
rb_str_dynamic_intern.
* template/id.h.tmpl: use LSB of ID as a flag for determining a
static symbol, so we shift left other ruby_id_types.
* string.c: use rb_sym2str instead `rb_id2str(SYM2ID(sym))` to
avoid pinning.
* load.c: use xx_without_pindown function at creating temporary ID
to avoid pinning.
* object.c: ditto.
* sprintf.c: ditto.
* struct.c: ditto.
* thread.c: ditto.
* variable.c: ditto.
* vm_method.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
garbage_collect_with_gvl() here on non-ruby threads.
Should just ignore the malloc_increase.
This issue is pointed by Eric Wong [ruby-core:61519].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This hopefully works on all platforms with malloc_usable_size.
This may also trigger bugs in places which did not expect GC, too;
so maybe some existing code will need RB_GC_GUARD.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
add links to `Object#hash` to each #`hash` methods rdocs.
[Fixes GH-567]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
at first.
And return immediately if we don't touch sorted list any more.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/ruby.h (RB_GC_GUARD):
use rb_gc_guarded_ptr_val on non-GCC/MSC
* gc.c (rb_gc_guarded_ptr_val): rename and adjust argument.
RB_GC_GUARD should be robust enough for any compiler.
[ruby-core:60816] [Bug #7805]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
"RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR" to control major/minor GC
frequency.
Do full GC when the number of old objects is more than R * N
where R is this factor and
N is the number of old objects just after last full GC.
* test/ruby/test_gc.rb: add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This function *ONLY* works just after marking phase,
before any sweeping.
This function is highly depending current GC implementation
and can be removed future version.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e