| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
This commit adds support for embedded strings with variable capacity and
uses Variable Width Allocation to allocate strings.
|
|
|
|
|
|
|
|
|
|
|
| |
When `require "objspace/trace"` fails, previously the failure says:
```
1) Failure:
TestObjSpace#test_objspace_trace [/tmp/ruby/v3/src/trunk-mjit/test/objspace/test_objspace.rb:621]:
<3> expected but was
<0>.
```
but this is hard to debug.
|
|
|
|
|
|
|
|
|
| |
This file, when require'ed, starts tracing the object allocations, and
redefines `Kernel#p` to show the allocation site.
This commit is experimental; the library name and APIs may change.
[Feature #17762]
|
| |
|
|
|
|
|
|
|
| |
`memsize_of(Object.new)` can be changed with past ivar creation
history for Object instances (another Object instance has 4 or
more ivars, next created Object instance has the area for the
ivars). So use antoher class for the comparison.
|
|
|
|
|
|
|
|
| |
test_memsize_of_iseq fails on repeat tests and it seems to difficult
to solve immediately. Now this test is skipped.
It seems that the result of `memsize_of(Object.new)` are increased.
Why...?
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
RUBY_INTERNAL_EVENT_NEWOBJ can expose uninitialized imemo_env
objects and marking it will cause critical error. This patch
skips marking on uninitialized imemo_env.
See: http://rubyci.s3.amazonaws.com/centos7/ruby-master/log/20210329T183003Z.fail.html.gz
Shortest repro-code is provided by mame-san.
|
| |
|
| |
|
|
|
|
|
|
|
| |
RDoc says `ObjectSpace.dump(obj, output: :stdout) # => nil`,
but it returns STDOUT since fbba6bd4e3dff7a61965208fecae908f10c4edbe.
I think it is unintentional change.
|
|
|
|
|
|
|
| |
The added test case crashes the interpreter because it makes
ObjectSpace.internal_class_of return the second VALUE slot of an AST
imemo object. The second VALUE slot of `struct rb_ast_struct` is
not a VALUE and not a pointer to a Ruby object.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The two main optimization are:
- buffer writes for improved performance
- avoid formatting functions when possible
```
| |compare-ruby|built-ruby|
|:------------------|-----------:|---------:|
|dump_all_string | 1.038| 195.925|
| | -| 188.77x|
|dump_all_file | 33.453| 139.645|
| | -| 4.17x|
|dump_all_dev_null | 44.030| 278.552|
| | -| 6.33x|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is useful to see what a block of code allocated, e.g.
```
GC.start
GC.disable
ObjectSpace.trace_object_allocations do
# run some code
end
gc_gen = GC.count
allocations = ObjectSpace.dump_all(output: :file, since: gc_gen)
GC.enable
GC.start
retentions = ObjectSpace.dump_all(output: :file, since: gc_gen)
```
|
|
|
|
| |
were not initialized
|
|
|
|
|
| |
Compaction makes collisions in the weak map more likely. For now, clear
the tracing information before the test run so we get accurate results
|
|
|
|
|
|
|
|
|
|
| |
The allocation tracing code keeps essentially a weak reference to
objects that have been allocated (storing the allocation information
along with the weak ref). Compacting the heap would break references in
this weak map, so the wrong values could be returned.
This commit just updates the values in the weak ref in order to fix the
allocation tracing book keeping
|
|
|
|
|
|
|
|
|
|
|
| |
```
1) Failure:
TestObjSpace#test_trace_object_allocations [/tmp/ruby/v3/src/trunk-gc_compact/test/objspace/test_objspace.rb:175]:
<nil> expected but was
<"/tmp/ruby/v3/src/trunk-gc_compact/test/objspace/test_objspace.rb">.
```
@tenderlove will re-enable it soon.
|
|
|
|
|
|
|
|
| |
It's possible to define methods with any name, even if the parser
doesn't support it and it can only be used with ex. send.
This fixes an issue where invalid JSON was output from ObjectSpace.dump
when a method name needed escaping.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
"exclusive access mode is not supported" exception has resulted in
empty "rubyheap-*.json" files after test/objspace/test_objspace.rb.
|
|
|
|
| |
[Bug #14194]
|
| |
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
| |
`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
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
* 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
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
(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
|
|
|
|
|
|
|
|
|
|
|
|
| |
[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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
|
|
| |
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
|