fluent / sigdump

Use signal to show stacktrace of a Ruby process without restarting it
Apache License 2.0
188 stars 27 forks source link

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

Open ko1 opened 5 years ago

ko1 commented 5 years ago

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...