i want to calculate size of objects in netbeans, i try to use
long freeMem = Runtime.getRuntime().freeMemory();
long totalMem = Runtime.getRuntime().totalMemory();
but i notice that the result of this method change every time i run project,
then try to use Caliper
library and use ObjectGraphMeasure.measure
method that result :
Objects=270813, NonNullRefs=353968, NullRefs=1016731, Primitives=[int x 388091, double x 4375548, long x 2609976, boolean x 6398, float x 76765, char x 66658]
i want the size of object in bytes.