1 /* |
1 /* |
2 * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
47 * </blockquote> |
47 * </blockquote> |
48 * |
48 * |
49 * It can be obtained by calling the |
49 * It can be obtained by calling the |
50 * {@link PlatformManagedObject#getObjectName} method. |
50 * {@link PlatformManagedObject#getObjectName} method. |
51 * |
51 * |
52 * <h4>Memory Type</h4> |
52 * <h3>Memory Type</h3> |
53 * <p>The Java virtual machine has a heap for object allocation and also |
53 * <p>The Java virtual machine has a heap for object allocation and also |
54 * maintains non-heap memory for the method area and the Java virtual |
54 * maintains non-heap memory for the method area and the Java virtual |
55 * machine execution. The Java virtual machine can have one or more |
55 * machine execution. The Java virtual machine can have one or more |
56 * memory pools. Each memory pool represents a memory area |
56 * memory pools. Each memory pool represents a memory area |
57 * of one of the following types: |
57 * of one of the following types: |
58 * <ul> |
58 * <ul> |
59 * <li>{@link MemoryType#HEAP heap}</li> |
59 * <li>{@link MemoryType#HEAP heap}</li> |
60 * <li>{@link MemoryType#NON_HEAP non-heap}</li> |
60 * <li>{@link MemoryType#NON_HEAP non-heap}</li> |
61 * </ul> |
61 * </ul> |
62 * |
62 * |
63 * <h4>Memory Usage Monitoring</h4> |
63 * <h3>Memory Usage Monitoring</h3> |
64 * |
64 * |
65 * A memory pool has the following attributes: |
65 * A memory pool has the following attributes: |
66 * <ul> |
66 * <ul> |
67 * <li><a href="#Usage">Memory usage</a></li> |
67 * <li><a href="#Usage">Memory usage</a></li> |
68 * <li><a href="#PeakUsage">Peak memory usage</a></li> |
68 * <li><a href="#PeakUsage">Peak memory usage</a></li> |
69 * <li><a href="#UsageThreshold">Usage Threshold</a></li> |
69 * <li><a href="#UsageThreshold">Usage Threshold</a></li> |
70 * <li><a href="#CollectionThreshold">Collection Usage Threshold</a> |
70 * <li><a href="#CollectionThreshold">Collection Usage Threshold</a> |
71 * (only supported by some <em>garbage-collected</em> memory pools)</li> |
71 * (only supported by some <em>garbage-collected</em> memory pools)</li> |
72 * </ul> |
72 * </ul> |
73 * |
73 * |
74 * <h4><a name="Usage">1. Memory Usage</a></h4> |
74 * <h3><a name="Usage">1. Memory Usage</a></h3> |
75 * |
75 * |
76 * The {@link #getUsage} method provides an estimate |
76 * The {@link #getUsage} method provides an estimate |
77 * of the current usage of a memory pool. |
77 * of the current usage of a memory pool. |
78 * For a garbage-collected memory pool, the amount of used memory |
78 * For a garbage-collected memory pool, the amount of used memory |
79 * includes the memory occupied by all objects in the pool |
79 * includes the memory occupied by all objects in the pool |
84 * when objects are not packed contiguously, this method may be |
84 * when objects are not packed contiguously, this method may be |
85 * an expensive operation that requires some computation to determine |
85 * an expensive operation that requires some computation to determine |
86 * the current memory usage. An implementation should document when |
86 * the current memory usage. An implementation should document when |
87 * this is the case. |
87 * this is the case. |
88 * |
88 * |
89 * <h4><a name="PeakUsage">2. Peak Memory Usage</a></h4> |
89 * <h3><a name="PeakUsage">2. Peak Memory Usage</a></h3> |
90 * |
90 * |
91 * The Java virtual machine maintains the peak memory usage of a memory |
91 * The Java virtual machine maintains the peak memory usage of a memory |
92 * pool since the virtual machine was started or the peak was reset. |
92 * pool since the virtual machine was started or the peak was reset. |
93 * The peak memory usage is returned by the {@link #getPeakUsage} method |
93 * The peak memory usage is returned by the {@link #getPeakUsage} method |
94 * and reset by calling the {@link #resetPeakUsage} method. |
94 * and reset by calling the {@link #resetPeakUsage} method. |
95 * |
95 * |
96 * <h4><a name="UsageThreshold">3. Usage Threshold</a></h4> |
96 * <h3><a name="UsageThreshold">3. Usage Threshold</a></h3> |
97 * |
97 * |
98 * Each memory pool has a manageable attribute |
98 * Each memory pool has a manageable attribute |
99 * called the <i>usage threshold</i> which has a default value supplied |
99 * called the <i>usage threshold</i> which has a default value supplied |
100 * by the Java virtual machine. The default value is platform-dependent. |
100 * by the Java virtual machine. The default value is platform-dependent. |
101 * The usage threshold can be set via the |
101 * The usage threshold can be set via the |
302 * by the {@link #getUsageThresholdCount} method to determine if |
302 * by the {@link #getUsageThresholdCount} method to determine if |
303 * such situation has occurred. |
303 * such situation has occurred. |
304 * </li> |
304 * </li> |
305 * </ol> |
305 * </ol> |
306 * |
306 * |
307 * <h4><a name="CollectionThreshold">4. Collection Usage Threshold</a></h4> |
307 * <h3><a name="CollectionThreshold">4. Collection Usage Threshold</a></h3> |
308 * |
308 * |
309 * Collection usage threshold is a manageable attribute only applicable |
309 * Collection usage threshold is a manageable attribute only applicable |
310 * to some garbage-collected memory pools. |
310 * to some garbage-collected memory pools. |
311 * After a Java virtual machine has expended effort in reclaiming memory |
311 * After a Java virtual machine has expended effort in reclaiming memory |
312 * space by recycling unused objects in a memory pool at garbage collection |
312 * space by recycling unused objects in a memory pool at garbage collection |