Skip to content

Conversation

@ko1
Copy link

@ko1 ko1 commented May 14, 2019

ObjectSpace.memsize_of(o) returns memory size information
of the object o. This patch shows the total memsize with
object counts for each classes.

  All objects:
         1: Thread (1,049,200)
    11,318: String (572,424)
       361: Class (287,296)
        16: File (134,784)
       141: Regexp (120,633)
        85: Hash (94,208)
        39: Module (48,816)
       729: Array (41,936)
...

Total memsize info are in parenthesises.

Note that ObjectSpace.memsize_of() can return wrong size
information. For example, if string objects shared the buffer
with others, it returns some strange information. Also T_DATA
(data typs defined by C-extensions) may not return its size
information.

Note2: The output seems too bad...

ObjectSpace.memsize_of(o) returns memory size information
of the object o. This patch shows the total memsize with
object counts for each classes.

```
  All objects:
         1: Thread (1,049,200)
    11,318: String (572,424)
       361: Class (287,296)
        16: File (134,784)
       141: Regexp (120,633)
        85: Hash (94,208)
        39: Module (48,816)
       729: Array (41,936)
...
```

Total memsize info are in parenthesises.

Note that ObjectSpace.memsize_of() can return wrong size
information. For example, if string objects shared the buffer
with others, it returns some strange information. Also T_DATA
(data typs defined by C-extensions) may not return its size
information.

Note2: The output seems bad...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant