Why dose max heap size change?
Krystal Mok
rednaxelafx at gmail.com
Sun Aug 12 08:47:58 PDT 2012
Hi Xudong,
I believe the class you're referring to is
java.lang.management.MemoryUsage. Quoting the docs [1]:
A MemoryUsage object represents a snapshot of memory usage. Instances of
the MemoryUsage class are usually constructed by methods that are used to
obtain memory usage information about individual memory pool of the Java
virtual machine or the heap or non-heap memory of the Java virtual machine
as a whole.
Which means MemoryUsage is not just used to represent the usage of the Java
heap as a whole. -Xmx only locks the maximum size of the Java heap, but
doesn't say anything about how the spaces within the Java heap should be
arranged.
Let's look at an example of a MemoryUsage object representing the usage of
a memory pool.
Try running JConsole on a HotSpot Server VM with default arguments. The
collector used by default would be the Parallel collector.
Go to the MBean tab, find the MBean of "PS Eden Space" from java.lang ->
MemoryPool, and open its Usage property. Refresh the value a few times, and
see if the max field changes.
In my environment, it does change over time. That's because the Parallel
collector uses an adaptive size policy, which could change the maximum size
of the generations adaptively.
Regards,
Kris
[1]:
http://docs.oracle.com/javase/7/docs/api/java/lang/management/MemoryUsage.html
On Sun, Aug 12, 2012 at 4:10 PM, 曹旭东 <caoxudong818 at gmail.com> wrote:
> Hi all,
>
> I am doing some monitor jobs for JVM with JMX, and has been stuck on a
> question about max heap size.
>
> The javadoc of the field *max* of class *java.lang.management.HeapUsage*says,
>
> "represents the maximum amount of memory (in bytes) that can be
> used for memory management. Its value may be undefined.
>
> *The maximum amount of memory may change over time if defined*. "
>
> So, my question is,
>
> Why dose max heap size change, if I defined it with Xmx?
>
> Any response will be appreciated.
>
> Best Regards.
>
> caoxudong
>
>
>
> _______________________________________________
> hotspot-gc-use mailing list
> hotspot-gc-use at openjdk.java.net
> http://mail.openjdk.java.net/mailman/listinfo/hotspot-gc-use
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/hotspot-gc-use/attachments/20120812/6a63aefe/attachment.html
More information about the hotspot-gc-use
mailing list