summaryrefslogtreecommitdiff
path: root/gc.c
AgeCommit message (Collapse)Author
2016-08-16merge revision(s) 55663: [Backport #12583]usa
* gc.c (gc_mark_roots): should mark the VM object itself to mark singleton class of the VM object. Before this patch, we only set mark bit for the VM object and invoke mark function separately. [Bug #12583] * test/ruby/test_gc.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@55921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-26merge revision(s) 53654:nagachika
* gc.c (RVALUE_PAGE_WB_UNPROTECTED): fix a typo of argument name. [Fix GH-1221] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@53662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-28merge revision(s) 51242: [Backport #11343]nagachika
* gc.c (__has_feature): move into internal.h. * internal.h (__has_feature): ditto. * internal.h (__has_extension): new macro. * internal.h (STATIC_ASSERT): use _Static_assert with clang. [ruby-core:69931] [Bug #11343] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@52778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-20merge revision(s) 49792: [Backport #10918]nagachika
* gc.c (id2ref): prohibit from accessing internal objects. [ruby-core:68348] [Bug #10918] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@50565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-24merge revision(s) 49474,49541,49545,49684: [Backport #10768]naruse
* gc.c (rb_objspace_free): cause rb_bug if lazy sweep is in progress during rb_objspace_free. Adds extra protection for r46340. Patch by Vicent Marti. [Bug #10768] [ruby-core:67734] * gc.c (rb_objspace_call_finalizer): Ensure GC is completed after finalizers have run. We already call gc_rest() before invoking finalizers, but finalizer can allocate new objects and start new GC cycle, so we call gc_rest() again after finalizers are complete. * gc.c (rb_objspace_call_finalizer): control GC execution during force firnalizations at the end of interpreter process. [Bug #10768] 1) Prohibit incremental GC while running Ruby-level finalizers to avoid any danger. 2) Prohibit GC while invoking T_DATA/T_FILE data structure because these operations break object relations consistency. This patch can introduce another memory consuming issue because Ruby-level finalizers can run after (2), GC is disabled. However, basically object consistency was broken at (2) as I described above. So that running Ruby-level finalizers contains danger originally. Because of this point, I need to suggest to remove these 3 lines (invoking remaining finalizers). And add a rule to add that finalizers should not add new finalizers, or say there is no guarantee to invoke finalizers that added by another finalizer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@49716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-25merge revision(s) 48999: [Backport #10646]naruse
* gc.c (wmap_final_func): fix memory size shortage when realloc wmap. Fix SEGV during finilize of WeakRef on Solaris (though the SEGV could occur on all OS/platforms). [ruby-dev:48779] [Bug #10646] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@49001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-24* gc.c: remove unused rb_objspace_t::rgengc::old_objects_at_gc_start.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-15GC documentation updatenormal
* gc.c (GC_HEAP_FREE_SLOTS): move definition to match use order (RUBY_GC_HEAP_GROWTH_SLOTS): s/factor/number of slots/ * man/ruby.1: add section for GC environment variables [Feature #10197] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-15* ext/objspace/objspace.c: ObjectSpace.memsize_of(obj) returnsko1
with sizeof(RVALUE). [Bug #8984] * gc.c (obj_memsize_of): ditto. * NEWS: add a NEWS entry. * test/objspace/test_objspace.rb: catch up this fix. * test/ruby/test_file_exhaustive.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-13gc.c (define_final0): avoid duplicate blocksnormal
This prevents excessive memory growth when a WeakRef is repeatedly created * gc.c (define_final0): avoid duplicate blocks [Bug #10537] * test/test_weakref.rb (test_repeated_object_leak): new test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-12* gc.c (gc_latest_gc_info): return :state field to show currentko1
GC state (none/marking/sweeping). [Feature #10590] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-11* class.c (class_alloc): Strat from age == 2.ko1
Class and Module objects can be living long life. * iseq.c: Same for ISeq objects. * gc.c (RVALUE_AGE_RESET): added. * gc.c (newobj_of): allow to generate (age != 0) objects. * gc.c (rb_copy_wb_protected_attribute): reset age for wb unprotected objects. * include/ruby/ruby.h: add RUBY_TYPED_PROMOTED1 as an unrecommended flag. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01use 0 for reservednobu
use 0 for rb_data_type_t::reserved instead of NULL, since its type may be changed in the future and possibly not a pointer type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-27* gc.c (objspace_malloc_increase): enable lazy sweep on GC by malloc()ko1
(malloc_increase) to make GC incrementally. This change can increase memory consumption. Report us if you find any problem. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-25rb_id2str over rb_id2namenobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-18* gc.c (gc_record): add information for debug print.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-18* internal.h: Gather declarations in non-header files.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15* internal.h: Include ruby.h and ruby/encoding.h to beakr
includable without prior inclusion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-14gc.c: check argumentsnobu
* gc.c (default_proc_for_compat_func): check arguments number and type, and get rid of reentering this default proc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-14* gc.c (gc_stat_internal): support comatible layer forko1
GC.stat(symbol) type acess. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-14* gc.c (gc_stat_internal): add compatible layer.ko1
From Ruby 2.2, keys of GC.stat are changed [Feature #9924]. To provide compatible layer, GC.stat add a default_proc (if default_proc of given Hash object is not set). At first use of this compatible layer of interpreter process, show a warning message like that: program: GC.stat[:total_allocated_object] warning message: "warning: GC.stat keys were changed from Ruby 2.1. In this case, you refer to obsolete `total_allocated_object' (new key is `total_allocated_objects'). Please check <https://bugs.ruby-lang.org/issues/9924> for more information." Pleaes correct my English message :) * hash.c (rb_hash_set_default_proc): export (in internal). * internal.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-14* gc.c: guard by #if/#endif with GC_ENABLE_INCREMENTAL_MARKko1
to hide unused codes. * gc.c: similar to GC_ENABLE_LAZY_SWEEP. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-13* gc.c: fix build error caused by implicit conversion with clang.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-13* gc.c: refactoring.ko1
* gc.c: use GC_ENABLE_INCREMENTAL_MARK instead of USE_RINCGC. * gc.c (gc_start): check FORCE_MAJOR_GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-13* gc.c: Tuning RincGC parameters.ko1
Before this patch, gc_marks_step() marks (white -> grey) fixed number objects. However, this strategy does not fit practical cases, for example too slow to make progres. This patch changes this strategy how many objects the gc_marks_step() should handle. We can estimate how many times gc_marks_step() is called during this major marking (== C) with the free slot number in pooled pages. We also can estimate the living object number (== L) using last marked_slots value. We can solve this problem (how many objects should be process in gc_marks_step()) by L/C. * gc.c (rb_objspace_t): add rb_objspace_t::rincgc::pooled_sltos and step_slots. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-12gc.c (struct heap_page): trivial packingnormal
304 => 296 bytes on x86-64 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-09* gc.c (is_incremental_marking): use #if/#else becauseko1
rb_objspace_t::flags::during_incremental_marking is not defined when GC_ENABLE_INCREMENTAL_MARK is 0. * gc.c (will_be_incremental_marking, is_full_marking): similar fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-02* gc.c (obj_info): show T_STRING more details.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-27* gc.c: is_incremental_marking(), will_be_incremental_marking():ko1
use `&&' with GC_ENABLE_INCREMENTAL_MARK intead of using #if/#else/#endif. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-27gc.c: fix no lazy sweep modenobu
* gc.c (gc_sweep_rest): sweep rest pages regardless of whether lazy sweep is enabled or not. based on the patch by Masahiro Ide at [ruby-dev:48706]. [Bug #10431] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-21* gc.c (mark_current_machine_context) [__mc68000__]: Update stacknaruse
marking. (rb_gc_mark_machine_stack) [__mc68000__]: Also handle it here. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48065 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-14* gc.c (rb_obj_id): [DOC] Fix typo, clean up sentence, and wrap colszzak
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-06symbol.h: move struct RSymbolnobu
* symbol.h (struct RSymbol): move from internal.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-28* gc.c (rb_gcdebug_print_obj_condition): use RVALUE_REMEMBEREDktsj
because GET_HEAP_REMEMBERSET_BITS is obsoleted. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-27ruby.h: deprecate plain Datanobu
* include/ruby/ruby.h (rb_data_object_alloc_deprecated): deprecate Data_Make_Struct and Data_Wrap_Struct. [EXPERIMENTAL] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-14compile.c, gc.c: suppress warningsnobu
* compile.c (iseq_compile_each): suppress implicit conversion warning by old apple gcc 4.2. * gc.c (RVALUE_FLAGS_AGE, heap_page_allocate): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-11* vm.c (rb_vm_register_special_exception): make new function toko1
make and register special exceptions. * vm.c (rb_vm_mark): do not need to mark special exceptions because they are registerd by rb_gc_register_mark_object(). * eval.c (Init_eval): use rb_vm_register_special_exception(). * gc.c (Init_GC): ditto. * proc.c (Init_Proc): ditto. * thread.c (Init_Thread): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-11* gc.c (rb_gc_mark_values): added.ko1
This function is similar to rb_gc_mark_locations(), but not conservertive. * internal.h: ditto. * vm.c (env_mark): use rb_gc_mark_values() because env values should be Ruby VALUEs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-11* gc.c (gc_mark_ptr): rename to gc_mark_set.ko1
* gc.c (gc_mark): add gc_mark_ptr() to skip is_markable_object() check. gc_mark_maybe() can use gc_mark_ptr() directly because passed pointer is checked by is_pointer_to_heap(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-11* include/ruby/ruby.h, gc.c: add new internal eventsko1
RUBY_INTERNAL_EVENT_GC_ENTER and RUBY_INTERNAL_EVENT_GC_EXIT. When invoking GC process, GC_ENTER event is called. When exiting from GC process, GC_EXIT event is called. Incremental GC (incremental marking and lazy sweep) can call these events many times. For example (minor marking): (1) GC_ENTER - (2) GC_START (minor GC) (minor marking) - (3) GC_END_MARK (start lazy sweep) (4) GC_EXIT (ruby process) (5) GC_ENTER (lazy sweep) (6) GC_EXIT (ruby process) (... repeat (5), (6)) (7) GC_ENTER (finish lazy sweep) - (8) GC_END_SWEEP (9) GC_EXIT 2nd example (incremental major marking): (1) GC_ENTER - (2) GC_START (minor GC) (start incremental marking) (3) GC_EXIT (ruby process) (4) GC_ENTER (incremental marking) (5) GC_EXIT (ruby process) (... repeat (4), (5)) (6) GC_ENTER (finish incremental marking) - (7) GC_END_MARK (start lazy sweep) (8) GC_EXIT (ruby process) (9) GC_ENTER (lazy sweep) (10) GC_EXIT (ruby process) (... repeat (9), (10)) (11) GC_ENTER (finish lazy marking) - (12) GC_STOP_SWEEP (13) GC_EXIT Thease internal events enable to measure GC pause time completely. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-11* include/ruby/ruby.h: freeze nil/true/false.ko1
* gc.c (should_be_finalizable): check frozen after checkin FL_ABLE. * object.c (rb_obj_taint): check OBJ_TAINTABLE(obj). * object.c (rb_obj_freeze): remove immediate_frozen_tbl because all of immediate values are frozen. YAY! * object.c (rb_obj_frozen_p): ditto. * test/ruby/test_eval.rb: skip instance_variable_set for frozen objects. * test/ruby/test_weakmap.rb: check ArgumentError instead of RuntimeError. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10gc.c: preserve encodingnobu
* gc.c (should_be_callable): preserve encoding of class name in error messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10* gc.c (gc_stat): update rdoc.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10* gc.c (gc_stat_internal): rename:ko1
* malloc_increase -> malloc_increase_bytes * malloc_limit -> malloc_increase_bytes_limit * oldmalloc_increase -> oldmalloc_increase_bytes * oldmalloc_limit -> oldmalloc_increase_bytes_limit ref: [Feature #9924] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10* gc.c (gc_stat_internal): rename `heap_used' to `heap_allocated_pages'.ko1
ref: [Feature #9924] * test/ruby/test_gc.rb: add constraints test for gc stat information. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10* gc.c (gc_stat_internal): rename:ko1
* remembered_shady_object -> remembered_wb_unprotected_objects * remembered_shady_object_limit -> remembered_wb_unprotected_objects_limit * old_object -> old_objects * old_object_limit -> old_objects_limit ref: [Feature #9924] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10* gc.c (gc_stat_internal): support:ko1
* total_allocated_pages * total_freed_pages ref: [Feature #9924] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10* gc.c (objspace_total_slot): rename objspace_available_slots.ko1
* gc.c (objspace_live_slot, objspace_free_slot): rename ..._slot() to ..._slots(). * gc.c (objspace_free_slot): should subtract heap_pages_final_slots. * gc.c (gc_stat_internal): * add `heap_available_slots' field * rename heap_live_slot to heap_live_slots * rename heap_free_slot to heap_free_slots ref: [Feature #9924] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09* gc.c: refactoring for RGENGC_PROFILE > 0.ko1
* rename rb_objspace_t::profile::..._count to rb_objspace_t::profile::total_..._count * rename promote_infant_types to promote_types * gc.c (gc_remember_unprotected): count remembered shady objects here. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-09* gc.c (init_mark_stack): MEMZERO() receive type as 2nd argument insteadnagachika
of size. Coverity Scan found this bug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e