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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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!