Possible Duplicate:
In Java, what is the best way to determine the size of an object?
What is the technique to retrieve the # of bytes occupied by a class object/variable in Java?
Looking for an equivalent for SizeOf() operator in C.
Possible Duplicate:
In Java, what is the best way to determine the size of an object?
What is the technique to retrieve the # of bytes occupied by a class object/variable in Java?
Looking for an equivalent for SizeOf() operator in C.
I've used the SizeOf() project on Sourceforge before with decent success:
http://sourceforge.net/projects/sizeof/
However, based on how the JVM works, Sizeof for java is, at best, an intelligent guess based on predefined parameters rather than actually measuring the size of the memory allocation.
...so use this as a source of information rather than gospel!