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).
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).
Marshal doesn’t text - the output is binary. But there’s another
problem: what do you regard an object’s size? Is it just the instance?
Is it the instance plus certain members like Arrays, Strings and
numbers? Is it the whole graph of objects reachable from your object?
In any case how do you deal with aliasing, i.e. objects referenced by
more than one object? etc.
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).
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.
Take a look at object printing code in:
It prints reports like:
IV Table of object Complex(1.0, 2.0)
Flags = 2
Class = Complex
IV_TBL: