ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:71099] [Ruby trunk - Feature #11599] [Open] Dump entries of hash in ObjectSpace
       [not found] <redmine.issue-11599.20151017120607@ruby-lang.org>
@ 2015-10-17 12:06 ` yosy101
  2015-10-18 13:24 ` [ruby-core:71103] [Ruby trunk - Feature #11599] " nobu
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 14+ messages in thread
From: yosy101 @ 2015-10-17 12:06 UTC (permalink / raw)
  To: ruby-core

Issue #11599 has been reported by Yosi Attias.

----------------------------------------
Feature #11599: Dump entries of hash in ObjectSpace
https://bugs.ruby-lang.org/issues/11599

* Author: Yosi Attias
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
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:
~~~
hash = {
    int_key: 1,
    str_key: "This is my string",
    inner_hash: { b: 2 }
}
~~~

The dump result (ObjectSpace.dump(hash)) will be:
~~~
{
    "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)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:71103] [Ruby trunk - Feature #11599] Dump entries of hash in ObjectSpace
       [not found] <redmine.issue-11599.20151017120607@ruby-lang.org>
  2015-10-17 12:06 ` [ruby-core:71099] [Ruby trunk - Feature #11599] [Open] Dump entries of hash in ObjectSpace yosy101
@ 2015-10-18 13:24 ` nobu
  2015-10-18 17:18 ` [ruby-core:71105] " yosy101
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 14+ messages in thread
From: nobu @ 2015-10-18 13:24 UTC (permalink / raw)
  To: ruby-core

Issue #11599 has been updated by Nobuyoshi Nakada.

Description updated

Are `is_{key,value}_address` necessary?


----------------------------------------
Feature #11599: Dump entries of hash in ObjectSpace
https://bugs.ruby-lang.org/issues/11599#change-54473

* Author: Yosi Attias
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
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)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:71105] [Ruby trunk - Feature #11599] Dump entries of hash in ObjectSpace
       [not found] <redmine.issue-11599.20151017120607@ruby-lang.org>
  2015-10-17 12:06 ` [ruby-core:71099] [Ruby trunk - Feature #11599] [Open] Dump entries of hash in ObjectSpace yosy101
  2015-10-18 13:24 ` [ruby-core:71103] [Ruby trunk - Feature #11599] " nobu
@ 2015-10-18 17:18 ` yosy101
  2015-10-19  1:50 ` [ruby-core:71108] " nobu
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 14+ messages in thread
From: yosy101 @ 2015-10-18 17:18 UTC (permalink / raw)
  To: ruby-core

Issue #11599 has been updated by Yosi Attias.


Nobuyoshi Nakada wrote:
> Are `is_{key,value}_address` necessary?

Yes, because if the key/value are composite objects (not special consts, like string/hash/class) you want in the "key"/"value" to write put address,
and to make sure there are no confusion some one did some like this:
~~~
h = {address: "0x007fbc01110368" }

~~~

----------------------------------------
Feature #11599: Dump entries of hash in ObjectSpace
https://bugs.ruby-lang.org/issues/11599#change-54475

* Author: Yosi Attias
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
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)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:71108] [Ruby trunk - Feature #11599] Dump entries of hash in ObjectSpace
       [not found] <redmine.issue-11599.20151017120607@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2015-10-18 17:18 ` [ruby-core:71105] " yosy101
@ 2015-10-19  1:50 ` nobu
  2015-10-19  5:28 ` [ruby-core:71109] " yosy101
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 14+ messages in thread
From: nobu @ 2015-10-19  1:50 UTC (permalink / raw)
  To: ruby-core

Issue #11599 has been updated by Nobuyoshi Nakada.


Yosi Attias wrote:
> and to make sure there are no confusion some one did some like this:
> 
> ~~~ruby
> h = {address: "0x007fbc01110368" }
> ~~~

I can't get your point here.
`{"key":":a","value":"0x007f8f3c8baf88"}` seems clear enough to me.


----------------------------------------
Feature #11599: Dump entries of hash in ObjectSpace
https://bugs.ruby-lang.org/issues/11599#change-54479

* Author: Yosi Attias
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
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)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:71109] [Ruby trunk - Feature #11599] Dump entries of hash in ObjectSpace
       [not found] <redmine.issue-11599.20151017120607@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2015-10-19  1:50 ` [ruby-core:71108] " nobu
@ 2015-10-19  5:28 ` yosy101
  2015-10-19  6:52 ` [ruby-core:71110] " nobu
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 14+ messages in thread
From: yosy101 @ 2015-10-19  5:28 UTC (permalink / raw)
  To: ruby-core

Issue #11599 has been updated by Yosi Attias.


Nobuyoshi Nakada wrote:
> Yosi Attias wrote:
> > and to make sure there are no confusion some one did some like this:
> > 
> > ~~~ruby
> > h = {address: "0x007fbc01110368" }
> > ~~~
> 
> I can't get your point here.
> `{"key":":a","value":"0x007f8f3c8baf88"}` seems clear enough to me.

Yes, but how can you distinguish between string value which is address or address to other ruby object:
`h = {a: "0x007f8f3c8baf88"}` to `h = {a: {b: 1}}`



----------------------------------------
Feature #11599: Dump entries of hash in ObjectSpace
https://bugs.ruby-lang.org/issues/11599#change-54480

* Author: Yosi Attias
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
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)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:71110] [Ruby trunk - Feature #11599] Dump entries of hash in ObjectSpace
       [not found] <redmine.issue-11599.20151017120607@ruby-lang.org>
                   ` (4 preceding siblings ...)
  2015-10-19  5:28 ` [ruby-core:71109] " yosy101
@ 2015-10-19  6:52 ` nobu
  2015-10-19 18:28 ` [ruby-core:71118] " yosy101
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 14+ messages in thread
From: nobu @ 2015-10-19  6:52 UTC (permalink / raw)
  To: ruby-core

Issue #11599 has been updated by Nobuyoshi Nakada.


That distinction makes no sense.
Non-special-const objects (including `String`) are always shown in pointer reference form.
That `"0x007f8f3c8baf88"` is the content of a string but not the pointer, then it never appears with your patch.


----------------------------------------
Feature #11599: Dump entries of hash in ObjectSpace
https://bugs.ruby-lang.org/issues/11599#change-54481

* Author: Yosi Attias
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
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)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:71118] [Ruby trunk - Feature #11599] Dump entries of hash in ObjectSpace
       [not found] <redmine.issue-11599.20151017120607@ruby-lang.org>
                   ` (5 preceding siblings ...)
  2015-10-19  6:52 ` [ruby-core:71110] " nobu
@ 2015-10-19 18:28 ` yosy101
  2015-10-19 18:49 ` [ruby-core:71119] " yosy101
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 14+ messages in thread
From: yosy101 @ 2015-10-19 18:28 UTC (permalink / raw)
  To: ruby-core

Issue #11599 has been updated by Yosi Attias.


Nobuyoshi Nakada wrote:
> That distinction makes no sense.
> Non-special-const objects (including `String`) are always shown in pointer reference form.
> That `"0x007f8f3c8baf88"` is the content of a string but not the pointer, then it never appears with your patch.

Oh.. I understand what you are saying, I will fix that!
Just to make sure I understand your position, you say this distinction is not needed, and in case of this hash:

~~~

    str_key = "Hello world".freeze
    hash = {}
    hash[:a] = 1
    hash[str_key] = -1
~~~

You want the result to be:

~~~

{
    "address": "0x007fa3d28c2dc8",
    "type": "HASH",
    "class": "0x007fa3d30af400",
    "size": 2,
    "entries": [
        {
            "key": ":a",
            "value": "0x00000000000003"
        },
        {
            "key": "\"Hello world\"",
            "value": "0xffffffffffffffff"
        }
    ],
    "references": [
        "0x007fa3d28b1230"
    ],
    "memsize": 232,
    "flags": {
        "wb_protected": true
    }
}
~~~

If so, I have one question:
The addresses of the values - "0x00000000000003" / "0xffffffffffffffff", dosen't exist in the dump result - because we don't dump numerics in the dump, and how I can know what is the dump result?

Or you want the value logic to be:
1. If this is special const: write the inspected value of it
2. If this is not a special const: write it's address 

----------------------------------------
Feature #11599: Dump entries of hash in ObjectSpace
https://bugs.ruby-lang.org/issues/11599#change-54486

* Author: Yosi Attias
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
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)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:71119] [Ruby trunk - Feature #11599] Dump entries of hash in ObjectSpace
       [not found] <redmine.issue-11599.20151017120607@ruby-lang.org>
                   ` (6 preceding siblings ...)
  2015-10-19 18:28 ` [ruby-core:71118] " yosy101
@ 2015-10-19 18:49 ` yosy101
  2015-10-23  8:57 ` [ruby-core:71171] " yosy101
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 14+ messages in thread
From: yosy101 @ 2015-10-19 18:49 UTC (permalink / raw)
  To: ruby-core

Issue #11599 has been updated by Yosi Attias.

File objspace_dump.patch added

Yosi Attias wrote:
> Nobuyoshi Nakada wrote:
> > That distinction makes no sense.
> > Non-special-const objects (including `String`) are always shown in pointer reference form.
> > That `"0x007f8f3c8baf88"` is the content of a string but not the pointer, then it never appears with your patch.
> 
> Oh.. I understand what you are saying, I will fix that!
> Just to make sure I understand your position, you say this distinction is not needed, and in case of this hash:
> 
> ~~~
> 
>     str_key = "Hello world".freeze
>     hash = {}
>     hash[:a] = 1
>     hash[str_key] = -1
> ~~~
> 
> You want the result to be:
> 
> ~~~
> 
> {
>     "address": "0x007fa3d28c2dc8",
>     "type": "HASH",
>     "class": "0x007fa3d30af400",
>     "size": 2,
>     "entries": [
>         {
>             "key": ":a",
>             "value": "0x00000000000003"
>         },
>         {
>             "key": "\"Hello world\"",
>             "value": "0xffffffffffffffff"
>         }
>     ],
>     "references": [
>         "0x007fa3d28b1230"
>     ],
>     "memsize": 232,
>     "flags": {
>         "wb_protected": true
>     }
> }
> ~~~
> 
> If so, I have one question:
> The addresses of the values - "0x00000000000003" / "0xffffffffffffffff", dosen't exist in the dump result - because we don't dump numerics in the dump, and how I can know what is the dump result?
> 
> Or you want the value logic to be:
> 1. If this is special const: write the inspected value of it
> 2. If this is not a special const: write it's address


Hi,
I have added to reflect the new logic:
* If the key/value are special consts - I write the "to_s" value of them (:a => "a", 1 => "1")
* If the key/value are not special consts - they pointer reference will be written

And I have removed the "is_key_address" and "is_value_address"  


----------------------------------------
Feature #11599: Dump entries of hash in ObjectSpace
https://bugs.ruby-lang.org/issues/11599#change-54487

* Author: Yosi Attias
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
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/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:71171] [Ruby trunk - Feature #11599] Dump entries of hash in ObjectSpace
       [not found] <redmine.issue-11599.20151017120607@ruby-lang.org>
                   ` (7 preceding siblings ...)
  2015-10-19 18:49 ` [ruby-core:71119] " yosy101
@ 2015-10-23  8:57 ` yosy101
  2015-10-24 15:51 ` [ruby-core:71180] " yosy101
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 14+ messages in thread
From: yosy101 @ 2015-10-23  8:57 UTC (permalink / raw)
  To: ruby-core

Issue #11599 has been updated by Yosi Attias.

Assignee set to Nobuyoshi Nakada

----------------------------------------
Feature #11599: Dump entries of hash in ObjectSpace
https://bugs.ruby-lang.org/issues/11599#change-54546

* 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/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:71180] [Ruby trunk - Feature #11599] Dump entries of hash in ObjectSpace
       [not found] <redmine.issue-11599.20151017120607@ruby-lang.org>
                   ` (8 preceding siblings ...)
  2015-10-23  8:57 ` [ruby-core:71171] " yosy101
@ 2015-10-24 15:51 ` yosy101
  2015-11-21 12:00 ` [ruby-core:71624] " yosy101
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 14+ messages in thread
From: yosy101 @ 2015-10-24 15:51 UTC (permalink / raw)
  To: ruby-core

Issue #11599 has been updated by Yosi Attias.


What is the status of the patch? Is this ok? something to fix?

----------------------------------------
Feature #11599: Dump entries of hash in ObjectSpace
https://bugs.ruby-lang.org/issues/11599#change-54560

* 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/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:71624] [Ruby trunk - Feature #11599] Dump entries of hash in ObjectSpace
       [not found] <redmine.issue-11599.20151017120607@ruby-lang.org>
                   ` (9 preceding siblings ...)
  2015-10-24 15:51 ` [ruby-core:71180] " yosy101
@ 2015-11-21 12:00 ` yosy101
  2015-11-23 21:34 ` [ruby-core:71644] " tenderlove
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 14+ messages in thread
From: yosy101 @ 2015-11-21 12:00 UTC (permalink / raw)
  To: ruby-core

Issue #11599 has been updated by Yosi Attias.


**Can I get a fair explanation of why this issue abandoned?**

----------------------------------------
Feature #11599: Dump entries of hash in ObjectSpace
https://bugs.ruby-lang.org/issues/11599#change-55024

* 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/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:71644] [Ruby trunk - Feature #11599] Dump entries of hash in ObjectSpace
       [not found] <redmine.issue-11599.20151017120607@ruby-lang.org>
                   ` (10 preceding siblings ...)
  2015-11-21 12:00 ` [ruby-core:71624] " yosy101
@ 2015-11-23 21:34 ` tenderlove
  2015-11-23 21:37 ` [ruby-core:71645] " yosy101
  2015-11-24 17:52 ` [ruby-core:71657] " yosy101
  13 siblings, 0 replies; 14+ messages in thread
From: tenderlove @ 2015-11-23 21:34 UTC (permalink / raw)
  To: ruby-core

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/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:71645] [Ruby trunk - Feature #11599] Dump entries of hash in ObjectSpace
       [not found] <redmine.issue-11599.20151017120607@ruby-lang.org>
                   ` (11 preceding siblings ...)
  2015-11-23 21:34 ` [ruby-core:71644] " tenderlove
@ 2015-11-23 21:37 ` yosy101
  2015-11-24 17:52 ` [ruby-core:71657] " yosy101
  13 siblings, 0 replies; 14+ messages in thread
From: yosy101 @ 2015-11-23 21:37 UTC (permalink / raw)
  To: ruby-core

Issue #11599 has been updated by Yosi Attias.


Aaron Patterson wrote:
> 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?

Thanks :)
Just throwing out - If the dump size is something that matters and we want to decrease it - I am thinking about writing in some binary format (msgpack/protobuf, with protobuf you will get backward compatible).



----------------------------------------
Feature #11599: Dump entries of hash in ObjectSpace
https://bugs.ruby-lang.org/issues/11599#change-55048

* 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/

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [ruby-core:71657] [Ruby trunk - Feature #11599] Dump entries of hash in ObjectSpace
       [not found] <redmine.issue-11599.20151017120607@ruby-lang.org>
                   ` (12 preceding siblings ...)
  2015-11-23 21:37 ` [ruby-core:71645] " yosy101
@ 2015-11-24 17:52 ` yosy101
  13 siblings, 0 replies; 14+ messages in thread
From: yosy101 @ 2015-11-24 17:52 UTC (permalink / raw)
  To: ruby-core

Issue #11599 has been updated by Yosi Attias.

Assignee changed from Nobuyoshi Nakada to Aman Gupta

----------------------------------------
Feature #11599: Dump entries of hash in ObjectSpace
https://bugs.ruby-lang.org/issues/11599#change-55062

* Author: Yosi Attias
* Status: Open
* Priority: Normal
* Assignee: Aman Gupta
----------------------------------------
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/

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-11-24 17:21 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-11599.20151017120607@ruby-lang.org>
2015-10-17 12:06 ` [ruby-core:71099] [Ruby trunk - Feature #11599] [Open] Dump entries of hash in ObjectSpace yosy101
2015-10-18 13:24 ` [ruby-core:71103] [Ruby trunk - Feature #11599] " nobu
2015-10-18 17:18 ` [ruby-core:71105] " yosy101
2015-10-19  1:50 ` [ruby-core:71108] " nobu
2015-10-19  5:28 ` [ruby-core:71109] " yosy101
2015-10-19  6:52 ` [ruby-core:71110] " nobu
2015-10-19 18:28 ` [ruby-core:71118] " yosy101
2015-10-19 18:49 ` [ruby-core:71119] " yosy101
2015-10-23  8:57 ` [ruby-core:71171] " yosy101
2015-10-24 15:51 ` [ruby-core:71180] " yosy101
2015-11-21 12:00 ` [ruby-core:71624] " yosy101
2015-11-23 21:34 ` [ruby-core:71644] " tenderlove
2015-11-23 21:37 ` [ruby-core:71645] " yosy101
2015-11-24 17:52 ` [ruby-core:71657] " yosy101

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).