File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Memory calculations... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Memory calculations..." Watch "Memory calculations..." New topic
Author

Memory calculations...

Chinmay Bajikar
Ranch Hand

Joined: Dec 08, 2001
Posts: 159
Hi,
I have to estimate how much mem a particular object is taking at runtime.
I have tried JProfiler,but have found that it is quiet an heavy application in itself.
Is there any freeware which will give me a decent estimation of how much increase/decrease in mem have been caused by the changes made to the code by me?
Thanks,
Chinmay.....


The strength of the Wolf is the pack & the strength of the pack is the wolf....Rudyard Kipling
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Take a look at JavaWorld's Java Tip 130: Do you know your data size?.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Chinmay Bajikar
Ranch Hand

Joined: Dec 08, 2001
Posts: 159
Hi Dirk,
I have gone thru the article and found it to be informative.
But didnt understand this one statement by Valdimir.....
"I am not sure why, but it's possible creating and destroying a method call-stack frame causes a change in the reachability root set and prompts the garbage collector to work harder."
Can u shed some light on this???
Thanks and regards,
Chinmay..

John O'Hanley
Greenhorn

Joined: Oct 13, 2002
Posts: 24
Here is some more <a href="http://www.javapractices.com/Topic83.cjp">example code</a> for this
task. It follows the style of the book "Java Platform Performance", by Wilson and Kesselman.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Originally posted by Chinmay Bajikar:
Hi Dirk,
I have gone thru the article and found it to be informative.
But didnt understand this one statement by Valdimir.....
"I am not sure why, but it's possible creating and destroying a method call-stack frame causes a change in the reachability root set and prompts the garbage collector to work harder."
Can u shed some light on this???

I'm not completely familiar with the details of garbage collection and JVM implementations. I believe that what the author is suggesting is that when a method terminates, this might send a special signal to the garbage collector that it consider running as some objects in memory were possibly just made unreachable (i.e. aren't being used any more).
 
Don't get me started about those stupid light bulbs.
 
subject: Memory calculations...