summaryrefslogtreecommitdiff
path: root/gc.c
AgeCommit message (Collapse)Author
2013-11-27* gc.c (gc_mark_stacked_objects): check only when check_mode > 0.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-27* gc.c (Init_GC): Add new GC::INTERNAL_CONSTANTS for information abouttmm1
GC heap/page/slot sizing. * test/ruby/test_gc.rb (class TestGc): test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-27* gc.c (gc_page_sweep): Fix compile warning from last commit.tmm1
* hash.c (hash_aset_str): Re-use existing variable to avoid unnecessary pointer dereferencing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-27* gc.c (gc_page_sweep): disable debug print.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-27* gc.c (gc_stat): add new information heap_eden_page_length andko1
heap_tomb_page_length. * test/ruby/test_gc.rb: fix to use GC.stat[:heap_eden_page_length] instead of GC.stat[:heap_length]. This test expects `heap_eden_page_length' (used pages size). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-27* gc.c: Rename rb_heap_t members:tmm1
used -> page_length limit -> total_slots git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-25* internal.h: do not use ruby_sized_xrealloc() and ruby_sized_xfree()ko1
if HAVE_MALLOC_USABLE_SIZE (or _WIN32) is defined. We don't need these function if malloc_usable_size() is available. * gc.c: catch up this change. * gc.c: define HAVE_MALLOC_USABLE_SIZE on _WIN32. * array.c (ary_resize_capa): do not use ruby_sized_xfree() with local variable to avoid "unused local variable" warning. This change only has few impact. * string.c (rb_str_resize): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-24* gc.c: continue to change OLDSPACE -> OLDMALLOC.ko1
RGENGC_ESTIMATE_OLDSPACE -> RGENGC_ESTIMATE_OLDMALLOC. * gc.c: add a new major GC reason GPR_FLAG_MAJOR_BY_OLDMALLOC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-24* gc.c: change terminlogy "..._num" to "..._slots" about slot opetaion.ko1
* final_num -> final_slots * objspace_live_num() -> objspace_live_slots() * objspace_limit_num() -> objspace_limit_slots() * objspace_free_num() -> objspace_free_slots() git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-24* gc.c (gc_stat): add internal information.ko1
* heap_swept_slot * malloc_increase * malloc_limit * remembered_shady_object * remembered_shady_object_limit * old_object * old_object_limit * oldmalloc_increase * oldmalloc_limit * gc.c (gc_stat): rename names. * heap_live_num -> heap_live_slot * heap_free_num -> heap_free_slot * heap_final_slot -> heap_final_slot Quote from RDoc of GC.stat(): "The contents of the hash are implementation specific and may be changed in the future." * test/ruby/test_gc.rb: catch up this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-24* gc.c: change terminology OLDSPACE -> OLDMALLOC.ko1
(oldspace -> oldmalloc for variable names) OLDSPACE is confusing because it is not includes slots. To more clearly, rename such as (oldspace_limit -> oldmalloc_limit). It is clear that it measures (estimates) malloc()'ed size. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-23* ChangeLog: fix a typo at r43744.nagachika
* gc.c (is_mark_stack_empty): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-23* gc.c: fix gloval variable name.ko1
Now we have following environments (and related variable names). * RUBY_GC_HEAP_INIT_SLOTS * RUBY_GC_HEAP_FREE_SLOTS * RUBY_GC_HEAP_GROWTH_FACTOR (new from 2.1) * RUBY_GC_HEAP_GROWTH_MAX_SLOTS (new from 2.1) * obsolete * RUBY_FREE_MIN -> RUBY_GC_HEAP_FREE_SLOTS (from 2.1) * RUBY_HEAP_MIN_SLOTS -> RUBY_GC_HEAP_INIT_SLOTS (from 2.1) * RUBY_GC_MALLOC_LIMIT * RUBY_GC_MALLOC_LIMIT_MAX (new from 2.1) * RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR (new from 2.1) * RUBY_GC_OLDSPACE_LIMIT (new from 2.1) * RUBY_GC_OLDSPACE_LIMIT_MAX (new from 2.1) * RUBY_GC_OLDSPACE_LIMIT_GROWTH_FACTOR (new from 2.1) * test/ruby/test_gc.rb: catch up this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-22* gc.c: Rename heap_pages_swept_num to heap_pages_swept_slots to clarify ↵tmm1
meaning (number of slots, not pages). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-22* gc.c (RUBY_ALIAS_FUNCTION_VOID): fix compile error.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-22* gc.c (heap_set_increment): accept minumum additional page number.ko1
* 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
2013-11-22* include/ruby/intern.h (rb_gc_set_params): Deprecatenari
rb_gc_set_params because it's only used in ruby internal. * internal.h (ruby_gc_set_params): Declare rb_gc_set_params's alias function. * gc.c: ditto. * ruby.c: use ruby_gc_set_params. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-22* vm.c (ruby_vm_destruct): do not use ruby_xfree() after freeingko1
objspace. * gc.c (ruby_mimfree): added. It is similar to ruby_mimmalloc(). * internal.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-22* gc.c: fix build failure on FreeBSD introduced by r43763.naruse
malloc_usable_size() is defined by malloc_np.h on FreeBSD. * configure.in: check malloc.h and malloc_np.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-21* gc.c: RGENGC_CHECK_MODE should be 0.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-21* gc.c: needs malloc.h if malloc_usable_size() is available.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-21gc.c: malloc_usable_sizenobu
* gc.c (malloc_usable_size): use _msize() on Windows. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-21gc.c: malloc_usable_sizenobu
* gc.c (vm_xrealloc, vm_xfree): use malloc_usable_size() to obtain old size if available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-21* gc.c: rename initial_xxx variables to gc_params.xxx.ko1
They are not only used initial values. Chikanaga-san: Congratulations on RubyPrize! git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-21* remove trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-21* gc.c: enable "RGENGC_ESTIMATE_OLDSPACE" option as default.ko1
Without this option, some application consumes huge memory. (and there are only a few performance down) Introduced new environment variables: * RUBY_GC_HEAP_OLDSPACE (default 16MB) * RUBY_GC_HEAP_OLDSPACE_MAX (default 128 MB) * RUBY_GC_HEAP_OLDSPACE_GROWTH_FACTOR (default 1.2) * gc.c (initial_malloc_limit): rename to initial_malloc_limit_min. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-21* gc.c (gc_marks_check): do not dump all refs.ko1
* gc.c (allrefs_dump_i): fix output format. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-21* remove trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-21* gc.c: change RGENGC_CHECK_MODE (>= 2) logic.ko1
Basically, make an object graph of all of living objects before and after marking and check status. [Before marking: check WB sanity] If there is a non-old object `obj' pointed from old object (`parent') then `parent' or `obj' should be remembered. [After marking: check marking miss] Traversible objects with the object graph should be marked. (However, this alert about objects pointed by machine context can be false positive. We only display alert.) [Implementation memo] objspace_allrefs() creates an object graph. The object graph is represented by st_table, key is object (VALUE) and value is referring objects. Referring objects are stored by "struct reflist". * gc.c (init_mark_stack): do not use push_mark_stack_chunk() at init. This pre-allocation causes failure on is_mark_stask_empty() without any pushing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-19* gc.c (heap_is_swept_object): use heap_page::before_sweep flag.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-19* gc.c (rb_objspace_reachable_objects_from_root): do major marking.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-19* gc.c (rb_gc_resurrect): added.ko1
rb_fstring() used rb_gc_mark() to avoid freeing used string. However, rb_gc_mark() set mark bit *and* pushes mark_stack. rb_gc_resurrect() does only set mark bit if it is before sweeping. * string.c (rb_fstring): use rb_gc_resurrect. * internal.h: add decl. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-10* gc.c (rb_gcdebug_print_obj_condition): catch up recent changesktsj
to compile on GC_DEBUG. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-09gc.c: finalizer functionsnobu
* gc.c (rb_define_finalizer, rb_undefine_finalizer): rename and export finalizer functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-09* gc.c (vm_malloc_increase): sweep immediately on GC due to malloc().ko1
To reduce memory usage, sweep as soon as possible. This behavior is same as Ruby 2.0.0 and before. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-09gc.c: private callnobu
* gc.c (should_be_callable): allow private call since rb_eval_cmd calls even private methods. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-09gc.c: should_be_callablenobu
* gc.c (should_be_callable): extract duplicate code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-09 * gc.c (gc_page_sweep, rgengc_rememberset_mark): Refactoring.tarui
Get bitmaps directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-09 * gc.c (RVALUE_PROMOTE_INFANT): Refactoring. Remove duplicated nonsensetarui
code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-09 * gc.c (gc_marks_test): Bugfix. Fix a struct member name for buildtarui
with RGENGC_CHECK_MODE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-08 * gc.c : Add GC_PROFILE_DETAIL_MEMORY option.tarui
If GC_PROFILE_MORE_DETAIL && GC_PROFILE_DETAIL_MEMORY, maxrss, minflt and majflt are added to each profile record. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-07gc.c: use switch for alternative BUILTIN_TYPEnobu
* gc.c (rb_objspace_call_finalizer): BUILTIN_TYPE is alternative, T_DATA object (Thread, Mutex, Fiber) cannot be T_FILE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-07* gc.c (vm_malloc_increase): check GVL before gc_rest_sweep().ko1
vm_malloc_increase() can be called without GVL. However, gc_rest_sweep() assumes acquiring GVL. To avoid this problem, check GVL before gc_rest_sweep(). [Bug #9090] This workaround introduces possibility to set malloc_limit as wrong value (*1). However, this may be rare case. So I commit it. *1: Without rest_sweep() here, gc_rest_sweep() can decrease malloc_increase due to ruby_sized_xfree(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-07* gc.c: modify malloc_limit strategy.ko1
* fix default vaues: GC_MALLOC_LIMIT_GROWTH_FACTOR GC_MALLOC_LIMIT: 8MB -> 16MB GC_MALLOC_LIMIT_MAX: 384MB -> 32MB * algorithm of malloc_limit increment. if (malloc_increase < malloc_limit) { next_malloc_limit = malloc_limit * factor if (malloc_limit > malloc_limit_max) { malloc_limit = malloc_increase } } This algorithm change malloc_limit from 16MB -> 32MB slowly. If malloc_limit exceeds malloc_limit_max, then increase with malloc_increase. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-06 * gc.c (gc_before_sweep): Change algorithm of malloc_limit totarui
conservative for closing to memory consumption of ruby 2.0. * gc.c (GC_MALLOC_LIMIT, GC_MALLOC_LIMIT_GROWTH_FACTOR): Adjust parameters for new algorithm. Example: make gcbench-rdoc on a pc time maxrss 2.0.0p343 285.27 281853952 trunk before patch 207.19 690405376 trunk after patch 211.59 312500224 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-06* gc.c: define RGENGC_ESTIMATE_OLDSPACE == 0 if USE_RGENGC is 0.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-05* gc.c (Init_GC): add GC::OPTS to show options.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-05 * gc.c (is_live_object): A hidden object may be a live object.tarui
[ruby-dev:47788] [Bug #9072] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-05* remove trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-05* gc.c: add support to estimate increase of oldspace memory usage.ko1
This is another approach to solve an issue discussed at r43530. This feature is diabled as default. This feature measures an increment of memory consuption by oldgen objects. It measures memory consumption for each objects when the object is promoted. However, measurement of memory consumption is not accurate now. So that this measurement is `estimation'. To implement this feature, move memsize_of() function from ext/objspace/objspace.c and expose rb_obj_memsize_of(). Some memsize() functions for T_DATA (T_TYPEDDATA) have problem to measure memory size, so that we ignores T_DATA objects now. For example, some functions skip NULL check for pointer. The macro RGENGC_ESTIMATE_OLDSPACE enables/disables this feature, and turned off as default. We need to compare 3gen GC and this feature carefully. (it is possible to enable both feature) We need a help to compare them. * internal.h: expose rb_obj_memsize_of(). * ext/objspace/objspace.c: use rb_obj_memsize_of() function. * cont.c (fiber_memsize): fix to check NULL. * variable.c (autoload_memsize): ditto. * vm.c (vm_memsize): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e