Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea: memsize_of() info for each classes. #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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