Object Size - jdk 1.5

hi, jdk1.5 has any method to get the object size in the memory Regardssiva
[116 byte] By [meqa] at [2007-10-2 6:58:33]
# 1

There are profilers such as JProbe that will tell you this. The only thing I know of in the JDK is to call Runtime.freeMemory() which tells you the amount of free memory in the VM. If you had a particularly large object you could do something like:

long begin = Runtime.getRuntime.freeMemory();

MyObject myObject = new MyObject(); // allocate the object

long result = Runtime.getRuntime.freeMemory() - begin;

This isn't very accurate but might help if you don't have the profiler.

swatdbaa at 2007-7-16 20:27:34 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...