9 Commits

Author SHA1 Message Date
zverok
e1b447a323 [DOC] Improve ObjectSpace#dump_XXX method docs
* remove false call-seq (output from Ruby parsing is cleaner)
* explain output: argument in plain words
* change parameter name in docs of #dump_shapes (typo)
2023-02-19 22:32:52 +02:00
Peter Zhu
5302d04e5a [DOC] Fix format in ObjectSpace.dump_all 2022-12-12 10:16:38 -05:00
Peter Zhu
be710c1bf7 [DOC] Fix format for ObjectSpace.dump_shapes 2022-12-12 10:15:24 -05:00
Peter Zhu
a9c3dc8d2e [DOC] Fix call-seq for ObjectSpace methods 2022-12-12 09:58:39 -05:00
Peter Zhu
58e3ce5de6 [DOC] Fix typo in docs for ObjectSpace.dump_all 2022-12-12 09:56:44 -05:00
Peter Zhu
87d5470873 [DOC] Fix indentation for ObjectSpace.dump_all 2022-12-12 09:51:12 -05:00
Jean Boussier
73771e4b19 ObjectSpace.dump_all: dump shapes as well
I see several arguments in doing so.

First they use a non trivial amount of memory, so for various memory
profiling/mapping tools it is relevant to have visibility of the space
occupied by shapes.

Then, some pathological code can create a tons of shape, so it is
valuable to have a way to have a way to observe shapes without having
to compile Ruby with `SHAPE_DEBUG=1`.

And additionally it's likely much faster to dump then this way than
to use `RubyVM::Shape`.

There are however a few open questions:

- Shapes can't respect the `since:` argument. Not sure what to do when
  it is provided. Would probably make sense to not dump them.
- Maybe it would make more sense to have a separate `ObjectSpace.dump_shapes`?
- Maybe instead `dump_all` should take a `shapes: false` argument?

Additionally, `ObjectSpace.dump_shapes` is added for the use case of
debugging the evolution of the shape tree.
2022-12-08 18:46:16 +01:00
Kazuhiro NISHIYAMA
d0a7189f26 Fix ObjectSpace.dump(obj, output: :stdout)
RDoc says `ObjectSpace.dump(obj, output: :stdout)   # => nil`,
but it returns STDOUT since fbba6bd4e3dff7a61965208fecae908f10c4edbe.

I think it is unintentional change.
2020-10-03 00:00:01 +09:00
Jean Boussier
fbba6bd4e3 Parse ObjectSpace.dump_all / dump arguments in Ruby to avoid allocation noise
[Feature #17045] ObjectSpace.dump_all should allocate as little as possible in the GC heap

Up until this commit ObjectSpace.dump_all allocates two Hash because of `rb_scan_args`.

It also can allocate a `File` because of `rb_io_get_write_io`.

These allocations are problematic because `dump_all` dumps the Ruby
heap, so it should try modify as little as possible what it is
observing.
2020-09-15 09:18:13 -07:00