On Tue, Mar 06, 2007 at 04:40:37PM +0900, Wes G. wrote:
I’d like to be able to estimate how much memory a given object requires.
What is the best/easiest way to do this? One thing that occurred to me
was the Marshal.dump the object to a file and look at that, although
looking at a textual representation of the object could be significantly
larger (I think).
Any advice is appreciated.
A rule of thumb:
for normal objects the memory footprint is around 100 bytes plus 20
instance variable (applies to objs. with <55 instance variables).
(Apply recursively if you want to consider referenced objects too.)
See the above link for more details regarding Arrays, Hashes, Symbols,