Is it possible to find the memory occupied by a object or variable in java? give me proper solution
Printable View
Is it possible to find the memory occupied by a object or variable in java? give me proper solution
Hi ravi,
You can use Runtime . freeMemory() for calculating object size.
First use this function to find the total free memory before object is created.
Create the object and again test the free memory using the fucntion. this will approximately return the memory size occupied by an object.
Thanks & Regards,
suresh