summaryrefslogtreecommitdiff
path: root/test/objspace
AgeCommit message (Collapse)Author
2019-06-30Suppress unused variable warningsNobuyoshi Nakada
2019-06-28Suppress unused variable warning with RUBYOPT=-wNobuyoshi Nakada
2019-06-28O_EXCL has no meaning for fdopenNobuyoshi Nakada
"exclusive access mode is not supported" exception has resulted in empty "rubyheap-*.json" files after test/objspace/test_objspace.rb.
2019-06-23Disable frozen-string-literal to disable deduplicationNobuyoshi Nakada
[Bug #14194]
2019-06-01Ignore warnings about ambiguous first argument of regexp with assert match.Hiroshi SHIBATA
2019-02-13fix imemo entry description.ko1
* ext/objspace/objspace.c (count_imemo_objects): `imemo_type_ids` should be match with `enum imemo_type` in internal.h and this patch fix mismatch. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-09ext/objspace/objspace_dump.c: print addresses consistentlynobu
The format addresses are printed in are different if you use `ObjectSpace.dump_all(output: :stdout)` vs. `ObjectSpace.dump_all(output: :string)` (or `ObjectSpace.dump`) due to differences in the underlying `vfprintf` implementation. Use `"%#"PRIxVALUE` to format `VALUE`. Co-authored-by: Ashe Connor <ashe@kivikakk.ee> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-09Revert "ext/objspace/objspace_dump.c: print addresses consistently"naruse
This reverts commit r64970. Visual C++ 12.0 doesn't have PRIxPTR. Anyway we have our own vfprintf implementation BSD_vfprintf(). If you want to have portable vfprintf, replace it with BSD_vfprintf like vsnprintf or just use BSD_vfprintf. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-08ext/objspace/objspace_dump.c: print addresses consistentlytenderlove
The format addresses are printed in are different if you use `ObjectSpace.dump_all(output: :stdout)` vs. `ObjectSpace.dump_all(output: :string)` (or `ObjectSpace.dump`) due to differences in the underlying `vfprintf` implementation. Use %"PRIxPTR" instead to be consistent across both. Co-authored-by: Ashe Connor <ashe@kivikakk.ee> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-10io.c: encoding of ARGF.inplace_modenobu
* io.c (argf_next_argv): encode inplace mode suffix to the path encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-17ext/objspace/objspace.c: remove unneeded code clones.mame
`setup_hash` have already performed nil check and empty check. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-22fix mortal_dynamic_symbol countnobu
* test/objspace/test_objspace.rb (test_count_symbols): exclude a dynamic symbol which has been turned into immortal by define_method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-22try to fix symbol duplication.ko1
* test/objspace/test_objspace.rb (test_count_symbols): make more complex dynamic symbols to avoid conflict with other existing static symbols. Sometimes this test fails with "mortal_dynamic_symbol=>127". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-31Add IMEMO type to heap dump output.tenderlove
IMEMO objects have many types. Without this change, we cannot see what types of IMEMO objects are being used when dumping the heap. Adding the type to the IMEMO object will allow us to gather statistics about IMEMO objects being used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-04adjust indent [ci skip]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-03Add `full` option to `ObjectSpace.dump_all`tenderlove
The `full` option includes all slots (even `T_NONE`) in the JSON output. This is to help with debugging heap fragmentation. Here is an example usage: ```ruby File.open('heap.json', 'w') do |f| ObjectSpace.dump_all(output: f, full: true) end ``` The `heap.json` file contains all slots, including empty slots. [Feature #13001] [ruby-core:78468] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-16Use JSON lines format for full heap dumps.tenderlove
This commit changes full heap dumps back to using JSON lines format (http://jsonlines.org) so that we can process very large heaps without loading the entire heap in to memory at once. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-12dump to stdoutnobu
* test/objspace/test_objspace.rb (test_dump_all): dump to stdout instead of a string, get rid of hung up. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-11ObjectSpace.dump_all: valid JSONnobu
* ext/objspace/objspace_dump.c: generate valid JSON for dump_all. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16Add frozen_string_literal: false for all filesnaruse
When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-19objspace_dump.c: special constnobu
* ext/objspace/objspace_dump.c: support special constant objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-15fix typos [ci skip]kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-14* test/objspace/test_objspace.rbnagachika
(test_trace_object_allocations_start_stop_clear): clear object allocation table first to get rid of erronous detection for obj3. [ruby-dev:49095] [Bug #11271] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-21* ext/objspace/objspace.c: add a new method ObjectSpace.count_symbols.ko1
[Feature #11158] * symbol.c (rb_sym_immortal_count): added to count immortal symbols. * symbol.h: ditto. * test/objspace/test_objspace.rb: add a test for this method. * NEWS: describe about this method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-12iseq.c (iseq_memsize): reimplement for wrappernormal
* iseq.c (iseq_memsize): reimplement for wrapper (param_keyword_size): extracted from iseq_memsize (iseqw_mark): new mark function (iseqw_data_type): new data type (iseqw_new): wrap as iseqw_data_type (iseqw_check): adjust for wrapper (Init_ISeq): remove iseqw_iseq_key initialization * test/objspace/test_objspace.rb: new test [ruby-core:70344] [Feature #11435] v2 changes: - added RUBY_TYPED_WB_PROTECTED and write barrier - account for rb_call_info_kw_arg_t entries git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-20* ext/objspace/objspace_dump.c(dump_object): Return empty JSON object whensorah
passed object is a special const, instead of SEGV. Based patch by Kohei Suzuki (eagletmt). [ruby-core:69692] [Bug #11291] * test/objspace/test_objspace.rb(test_dump_special_consts): Test for above fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-16* test/objspace/test_objspace.rb: relax pattern because uncollectibleko1
flag and marked flag can be false at major GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-28* ext/objspace/objspace.c: add two methods to debug internals.ko1
* ObjectSpace.internal_class_of: return RBASIC_CLASS(obj). * ObjectSpace.internal_super_of: return RCLASS_SUPER(cls). * NEWS: add information about both methods. * test/objspace/test_objspace.rb: add tests for both methods. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-10* test/objspace/test_objspace.rb: remove debug prints.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-10* ext/objspace/objspace.c: add ObjectSpace.count_imemo_objects methodko1
to count imemo objects for each type. * test/objspace/test_objspace.rb: add a test. * NEWS: describe about this addition. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-01test_objspace.rb: skip test_count_nodesnobu
* test/objspace/test_objspace.rb (test_count_nodes): NODEs are no longer used generally. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-18* test/objspace/test_objspace.rb: flag name was changedko1
(long_lived -> uncollectible). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-13test_objspace.rb: better assertionsnobu
* test/objspace/test_objspace.rb: use assertions for better failure messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49959 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-11-13* test/lib/envutil.rb: Moved from test/ruby/.akr
* test/lib/find_executable.rb: Ditto. * test/lib/memory_status.rb: Ditto. * test/lib/test/unit.rb: require envutil. * test/: Don't require envutil in test files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-08* gc.c: add incremental GC algorithm. [Feature #10137]ko1
Please refer this ticket for details. This change also introduces the following changes. * Remove RGENGC_AGE2_PROMOTION and introduce object age (0 to 3). Age can be count with FL_PROMOTE0 and FL_PROMOTE1 flags in RBasic::flags (2 bit). Age == 3 objects become old objects. * WB_PROTECTED flag in RBasic to WB_UNPROTECTED bitmap. * LONG_LIVED bitmap to represent living objects while minor GCs It specifies (1) Old objects and (2) remembered shady objects. * Introduce rb_objspace_t::marked_objects which counts marked objects in current marking phase. marking count is needed to introduce incremental marking. * rename mark related function and sweep related function to gc_(marks|sweep)_(start|finish|step|rest|continue). * rename rgengc_report() to gc_report(). * Add obj_info() function to get cstr of object details. * Add MEASURE_LINE() macro to measure execution time of specific line. * and many small fixes. * include/ruby/ruby.h: add flag USE_RINCGC. Now USE_RINCGC can be set only with USE_RGENGC. * include/ruby/ruby.h: introduce FL_PROMOTED0 and add FL_PROMOTED1 to count object age. * include/ruby/ruby.h: rewrite write barriers for incremental marking. * debug.c: catch up flag name changes. * internal.h: add rb_gc_writebarrier_remember() instead of rb_gc_writebarrier_remember_promoted(). * array.c (ary_memcpy0): use rb_gc_writebarrier_remember(). * array.c (rb_ary_modify): ditto. * hash.c (rb_hash_keys): ditto. * hash.c (rb_hash_values): ditto. * object.c (init_copy): use rb_copy_wb_protected_attribute() because FL_WB_PROTECTED is moved from RBasic::flags. * test/objspace/test_objspace.rb: catch up ObjectSpace.dump() changes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-11* test/objspace/test_objspace.rb (TestObjSpace#test_dump_uninitialized_file):ktsj
remove dependency on json library. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-10ext/objspace: Check fptr before trying to dump FILE object fdcharliesome
Patch by Scott Francis. Closes GH-562. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-10objspace_dump.c: include object's gc flags in dumptmm1
* ext/objspace/objspace_dump.c (dump_object): include fstring flag on strings. include gc flags (old, remembered, wb_protected) on all objects. * ext/objspace/objspace_dump.c (Init_objspace_dump): initialize lazy IDs before first use. * gc.c (rb_obj_gc_flags): new function to retrieve object flags * internal.h (RB_OBJ_GC_FLAGS_MAX): maximum flags allowed for one obj * test/objspace/test_objspace.rb (test_dump_flags): test for above * test/objspace/test_objspace.rb (test_trace_object_allocations): resolve name before dump (for rb_class_path_cached) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-05test_objspace.rb: show errornobu
* test/objspace/test_objspace.rb (test_dump_all): show error output if nothing dumped. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-05ext/objspace: remove OS.after_gc_start_hook= and move internal testtmm1
* ext/objspace/gc_hook.c: remove this file * ext/-test-/tracepoint/gc_hook.c: new filename for above * ext/objspace/objspace.c: remove ObjectSpace.after_gc_start_hook= * test/objspace/test_objspace.rb: remove test * test/-ext-/tracepoint/test_tracepoint.rb: add above test for tracepoint re-entry git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-26string.c: fix memsize of frozen shared stringnobu
* string.c (str_new4): copy the original capacity so that memsize of frozen shared string returns correct size. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-24* ext/objspace/objspace_dump.c: test fixes and win32 compatibilitytmm1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-14objspace_dump.c: refine outputnobu
* ext/objspace/objspace_dump.c (dump_output): allow IO object as output, and use Tempfile.create and return open file instead of mkstemp() and path name for :file output. [ruby-core:58266] [Bug #9102] * test/objspace/test_objspace.rb (TestObjSpace#dump_my_heap_please): remove temporary output file. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-09test_objspace.rb: assertion for temporary filenobu
* test/objspace/test_objspace.rb (TestObjSpace#test_dump_all): add assertion for output to temporary file. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-09* test/objspace/test_objspace.rb (test_dump_all): Make the test stringakr
shorter to be an embedded string on 32bit environment as well as 64bit environment. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-08* ext/objspace/object_tracing.c: Add experimental methods to dumptmm1
objectspace as json: ObjectSpace.dump_all and ObjectSpace.dump(obj). These methods are useful for debugging reference leaks and memory growth in large ruby applications. [Bug #9026] [ruby-core:57893] [Fixes GH-423] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-16* ext/objspace/objspace.c: add a new method `reachable_objects_from_root'.ko1
ObjectSpace.reachable_objects_from_root returns all objects refered from root (called "root objects"). This feature is for deep object analysis. * test/objspace/test_objspace.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-10vm_trace.c: fix infinite hooknobu
* thread.c (rb_threadptr_execute_interrupts): flush postponed job only once at last. * vm_trace.c (rb_postponed_job_flush): defer calling postponed jobs registered while flushing to get rid of infinite reentrance of ObjectSpace.after_gc_start_hook. [ruby-dev:47400] [Bug #8492] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-30* ext/objspace/object_tracing.c: add new 3 methods to control tracing.ko1
* ObjectSpace::trace_object_allocations_start * ObjectSpace::trace_object_allocations_stop * ObjectSpace::trace_object_allocations_clear And some refactoring. * test/objspace/test_objspace.rb: add a test for new methods. * NEWS: add a description for new methods. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e