< prev index next >

src/java.management/share/classes/java/lang/management/MemoryPoolMXBean.java

Print this page


   1 /*
   2  * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  32  *
  33  * <p> A Java virtual machine has one or more instances of the
  34  * implementation class of this interface.  An instance
  35  * implementing this interface is
  36  * an <a href="ManagementFactory.html#MXBean">MXBean</a>
  37  * that can be obtained by calling
  38  * the {@link ManagementFactory#getMemoryPoolMXBeans} method or
  39  * from the {@link ManagementFactory#getPlatformMBeanServer
  40  * platform MBeanServer} method.
  41  *
  42  * <p>The {@code ObjectName} for uniquely identifying the MXBean for
  43  * a memory pool within an {@code MBeanServer} is:
  44  * <blockquote>
  45  *    {@link ManagementFactory#MEMORY_POOL_MXBEAN_DOMAIN_TYPE
  46  *    java.lang:type=MemoryPool}{@code ,name=}<i>pool's name</i>
  47  * </blockquote>
  48  *
  49  * It can be obtained by calling the
  50  * {@link PlatformManagedObject#getObjectName} method.
  51  *
  52  * <h2>Memory Type</h2>
  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
  55  * machine execution.  The Java virtual machine can have one or more
  56  * memory pools.  Each memory pool represents a memory area
  57  * of one of the following types:
  58  * <ul>
  59  *   <li>{@link MemoryType#HEAP heap}</li>
  60  *   <li>{@link MemoryType#NON_HEAP non-heap}</li>
  61  * </ul>
  62  *
  63  * <h2>Memory Usage Monitoring</h2>
  64  *
  65  * A memory pool has the following attributes:
  66  * <ul>
  67  *   <li><a href="#Usage">Memory usage</a></li>
  68  *   <li><a href="#PeakUsage">Peak memory usage</a></li>
  69  *   <li><a href="#UsageThreshold">Usage Threshold</a></li>
  70  *   <li><a href="#CollectionThreshold">Collection Usage Threshold</a>
  71  *       (only supported by some <em>garbage-collected</em> memory pools)</li>
  72  * </ul>
  73  *
  74  * <h3><a id="Usage">1. Memory Usage</a></h3>
  75  *
  76  * The {@link #getUsage} method provides an estimate
  77  * of the current usage of a memory pool.
  78  * For a garbage-collected memory pool, the amount of used memory
  79  * includes the memory occupied by all objects in the pool
  80  * including both <em>reachable</em> and <em>unreachable</em> objects.
  81  *
  82  * <p>In general, this method is a lightweight operation for getting
  83  * an approximate memory usage.  For some memory pools, for example,


   1 /*
   2  * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  32  *
  33  * <p> A Java virtual machine has one or more instances of the
  34  * implementation class of this interface.  An instance
  35  * implementing this interface is
  36  * an <a href="ManagementFactory.html#MXBean">MXBean</a>
  37  * that can be obtained by calling
  38  * the {@link ManagementFactory#getMemoryPoolMXBeans} method or
  39  * from the {@link ManagementFactory#getPlatformMBeanServer
  40  * platform MBeanServer} method.
  41  *
  42  * <p>The {@code ObjectName} for uniquely identifying the MXBean for
  43  * a memory pool within an {@code MBeanServer} is:
  44  * <blockquote>
  45  *    {@link ManagementFactory#MEMORY_POOL_MXBEAN_DOMAIN_TYPE
  46  *    java.lang:type=MemoryPool}{@code ,name=}<i>pool's name</i>
  47  * </blockquote>
  48  *
  49  * It can be obtained by calling the
  50  * {@link PlatformManagedObject#getObjectName} method.
  51  *
  52  * <h3>Memory Type</h3>
  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
  55  * machine execution.  The Java virtual machine can have one or more
  56  * memory pools.  Each memory pool represents a memory area
  57  * of one of the following types:
  58  * <ul>
  59  *   <li>{@link MemoryType#HEAP heap}</li>
  60  *   <li>{@link MemoryType#NON_HEAP non-heap}</li>
  61  * </ul>
  62  *
  63  * <h3>Memory Usage Monitoring</h3>
  64  *
  65  * A memory pool has the following attributes:
  66  * <ul>
  67  *   <li><a href="#Usage">Memory usage</a></li>
  68  *   <li><a href="#PeakUsage">Peak memory usage</a></li>
  69  *   <li><a href="#UsageThreshold">Usage Threshold</a></li>
  70  *   <li><a href="#CollectionThreshold">Collection Usage Threshold</a>
  71  *       (only supported by some <em>garbage-collected</em> memory pools)</li>
  72  * </ul>
  73  *
  74  * <h3><a id="Usage">1. Memory Usage</a></h3>
  75  *
  76  * The {@link #getUsage} method provides an estimate
  77  * of the current usage of a memory pool.
  78  * For a garbage-collected memory pool, the amount of used memory
  79  * includes the memory occupied by all objects in the pool
  80  * including both <em>reachable</em> and <em>unreachable</em> objects.
  81  *
  82  * <p>In general, this method is a lightweight operation for getting
  83  * an approximate memory usage.  For some memory pools, for example,


< prev index next >