Please change your name to be compliant with JavaRanch's naming policy. Your displayed name should be 2 separate names with more than 1 letter each. We really would prefer that you use your REAL name. Thanks, Cindy Also, if you use the search function you will find lots of references to this topic. For instance there was a good conversation here.
"JavaRanch, where the deer and the Certified play" - David O'Meara
Doanh Your method can do the estimation, but not accurate. There is no way to accurately measure the size of object in Java as C sizeof() method. I guess that is intentional to hide some poor memory management problem in Java. Another thing is different JVM can have different implementation as well as different sizes. Read here to know a little more, a little old, but still useful: The Java IAQ:Infrequently Answered Questions Need Java real project experience? Join our project team here!
posted 18 years ago
Hi all Thanks for the information and the links provided. Thanks Dharmendra