-
1. Re: JVM Memory information
visolvejboss Jul 25, 2006 6:03 AM (in response to nabieh)Hello,
The Free Memory gives the details of free heap memory space, Max Memory gives the details of maximum allocated heap space and Total memory gives the details of total heap memory space. -
2. Re: JVM Memory information
nabieh Jul 25, 2006 8:06 AM (in response to nabieh)- Total memory gives the details of total heap memory space.
We have set the maximum heap size to 1 GB, I am asking why I have only 137 free? And what do you mean by "Details of Total space"? I am lost! Total of what?
Let us refer to a simple case, when I have 100 space, and the current free space is 30, then the used space must be 70. Where is the case in our example of Heap Size details? Thanks in advance.
Nabieh. -
3. Re: JVM Memory information
nabieh Jul 26, 2006 4:24 AM (in response to nabieh)Dears,
Any help please? That answer confused me instead of giving me the answer. Thanks in advance.
Nabieh. -
4. Re: JVM Memory information
jaikiran Jul 26, 2006 4:57 AM (in response to nabieh)All these values are obtained by invoking APIs provided by Java's java.lang.Runtime class. So the javadoc of the following methods might help you in understanding the same:
Free Memory: http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html#freeMemory()
Max Memory : http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html#maxMemory()
Total Memory : http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html#totalMemory() -
5. Re: JVM Memory information
peterj Jul 26, 2006 10:54 AM (in response to nabieh)The javadoc doesn't expalin the difference between max memory and total memory, and assumes that you undertsand how the heap works, which you can find at http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html.
But to summarize. The heap is broken up into several areas. One of those areas (the permanent generation) stores class-related intormation. Also, you can specifiy both a min (using -Xms) and a max (useing -Xmx) heap size. The heap is automatically resized between those values, based on object allocation and retention (usign a fairly complex algorithm). So, the differen heap statistics mean:
maxMemory - the maximum size of the heap minus the permanent generation
totalMemory - the amount of memeory currently allocated to the heap, once again minus the permanent generation
freeMemory - the amount of heap space available (this is out of 'totalMemory', not out of 'maxMemory')
If you check these stastics often while running you will see that 'max' doesn't change, 'total' changes occasionnally, and 'free' is probably different every time.