A
A
Anton Taraev2012-09-02 22:38:48
Ruby on Rails
Anton Taraev, 2012-09-02 22:38:48

How to find out how much memory an object takes?

There is an object, you need to determine how much memory it takes, is there any solution.
Only one option came to my mind, I took the amount of memory occupied by the process before the object was initialized and after throughps aux| grep <процесс>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rowdy Ro, 2012-09-02
@rowdyro

I don’t think that this is a completely correct decision, the system can allocate more memory than the process requested (for example, allocate a whole page), or in general in ruby ​​(I don’t know exactly) its own memory manager, which immediately asks the system for a large amount, and then resolves the memory under objects. You can try to poke around in the process memory in /proc or through /dev/mem.

S
Sergey, 2012-09-02
Protko @Fesor

Your method will not work, the arguments above were given by rowdyro. I picked ruby ​​a little, therefore my opinion is not authoritative in this matter. But maybe you should use profilers .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question