[#71439] [Ruby trunk - Feature #11339] [PATCH] io.c: avoid kwarg parsing in C API — matz@...
Issue #11339 has been updated by Yukihiro Matsumoto.
7 messages
2015/11/11
[#71473] Re: [Ruby trunk - Feature #11339] [PATCH] io.c: avoid kwarg parsing in C API
— Eric Wong <normalperson@...>
2015/11/13
Entire series for sockets
[#71450] Ruby 2.3.0-preview1 Released — "NARUSE, Yui" <naruse@...>
Hi,
5 messages
2015/11/11
[#71617] [Ruby trunk - Feature #11664] [PATCH] introduce rb_autoload_value to replace rb_autoload — nobu@...
Issue #11664 has been updated by Nobuyoshi Nakada.
3 messages
2015/11/20
[#71721] [Ruby trunk - Feature #11741] Migrate Ruby to Git from Subversion — me@...
Issue #11741 has been updated by Jon Moss.
4 messages
2015/11/28
[ruby-core:71644] [Ruby trunk - Feature #11599] Dump entries of hash in ObjectSpace
From:
tenderlove@...
Date:
2015-11-23 21:34:46 UTC
List:
ruby-core #71644
Issue #11599 has been updated by Aaron Patterson.
We should probably get Aman's opinion on this since he wrote the initial heap dumping code. Personally, I would like to see this feature enabled with a flag. It seems like it will significantly increase the size of the dump file, and also the dumped data will not be backwards compatible. Maybe if we add a flag to the `dump` method it would be easier to take this patch?
----------------------------------------
Feature #11599: Dump entries of hash in ObjectSpace
https://bugs.ruby-lang.org/issues/11599#change-55047
* Author: Yosi Attias
* Status: Open
* Priority: Normal
* Assignee: Nobuyoshi Nakada
----------------------------------------
Hi,
*This is my first c code contribution :)*
I am helping developing heap-analyzer (github.com/tenderlove/heap-analyzer), and currently the dumps lacks of "type metadata" information, like:
* Hash entries - the keys and value
* Array items - the items of the array
etc.
In the included patch, I have changed the dump of hash to add entries of hash.
For example, given the next hash:
~~~ruby
hash = {
int_key: 1,
str_key: "This is my string",
inner_hash: { b: 2 }
}
~~~
The dump result (ObjectSpace.dump(hash)) will be:
~~~json
{
"address": "0x007fbc01110340",
"type": "HASH",
"class": "0x007fbc0109b400",
"size": 3,
"entries": [
{
"is_key_address": false,
"key": ":int_key",
"is_value_address": false,
"value": "1"
},
{
"is_key_address": false,
"key": ":str_key",
"is_value_address": true,
"value": "0x007fbc01110390"
},
{
"is_key_address": false,
"key": ":inner_hash",
"is_value_address": true,
"value": "0x007fbc01110368"
}
],
"references": [
"0x007fbc01110390",
"0x007fbc01110368"
],
"memsize": 232,
"flags": {
"wb_protected": true
}
}
~~~
As you can see, I have the "entries" array, where each entry contains: "is_key_address", "is_value_address" - if the key/value are special consts the inspected value will be printed in the "key"/"value" properties, other their address will be print.
Hope you will accept the patch (and I can submit another one for arrays),
Yosi.
---Files--------------------------------
objspace_dump_hash_entries.patch (4.8 KB)
objspace_dump.patch (4.53 KB)
--
https://bugs.ruby-lang.org/