• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Memory calculations...

 
Chinmay Bajikar
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.....
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at JavaWorld's Java Tip 130: Do you know your data size?.
 
Chinmay Bajikar
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic