Interface MemoryMXBean

    • Method Detail

      • getMaxHeapSizeLimit

        long getMaxHeapSizeLimit()
        Get the maximum size in bytes to which the max heap size could be increased in the currently running VM. This may be larger than the current max heap size.
        Returns:
        value of -Xmx in bytes
      • getMaxHeapSize

        long getMaxHeapSize()
        Get the current maximum heap size in bytes.
        Returns:
        current value of -Xsoftmx in bytes
      • getMinHeapSize

        long getMinHeapSize()
        Get the minimum heap size in bytes.
        Returns:
        value of -Xms in bytes
      • setMaxHeapSize

        void setMaxHeapSize​(long size)
        Set the current maximum heap size to size. The parameter specifies the max heap size in bytes and must be between getMinHeapSize() and getMaxHeapSizeLimit(). See -Xsoftmx in the command line reference for additional details on the effect of setting softmx.
        Parameters:
        size - new -Xsoftmx value in bytes
        Throws:
        UnsupportedOperationException - if this operation is not supported.
        IllegalArgumentException - if input value size is either less than getMinHeapSize() or greater than getMaxHeapSizeLimit().
        SecurityException - if a SecurityManager is being used and the caller does not have the ManagementPermission value of "control".
      • isSetMaxHeapSizeSupported

        boolean isSetMaxHeapSizeSupported()
        Query whether the VM supports runtime reconfiguration of the maximum heap size through the setMaxHeapSize() call.
        Returns:
        true if setMaxHeapSize is supported, false otherwise
      • getSharedClassCacheSize

        long getSharedClassCacheSize()
        Returns the total size in bytes of the cache that the JVM is currently connected to.
        Returns:
        the number of bytes in the shared class cache.
      • getSharedClassCacheSoftmxBytes

        long getSharedClassCacheSoftmxBytes()
        Returns the softmx size in bytes of the cache that the JVM is currently connected to.
        Returns:
        the softmx bytes in the shared class cache or cache size if it is not set.
      • getSharedClassCacheMinAotBytes

        long getSharedClassCacheMinAotBytes()
        Returns the minimum space reserved for AOT data of the cache that the JVM is currently connected to.
        Returns:
        the minimum shared classes cache space reserved for AOT data in bytes or -1 if it is not set.
      • getSharedClassCacheMaxAotBytes

        long getSharedClassCacheMaxAotBytes()
        Returns the maximum space allowed for AOT data of the cache that the JVM is currently connected to.
        Returns:
        the maximum shared classes cache space allowed for AOT data or -1 if it is not set.
      • getSharedClassCacheMinJitDataBytes

        long getSharedClassCacheMinJitDataBytes()
        Returns the minimum space reserved for JIT data of the cache that the JVM is currently connected to.
        Returns:
        the minimum shared classes cache space reserved for JIT data or -1 if it is not set.
      • getSharedClassCacheMaxJitDataBytes

        long getSharedClassCacheMaxJitDataBytes()
        Returns the maximum space allowed for JIT data of the cache that the JVM is currently connected to.
        Returns:
        the maximum shared classes cache space allowed for JIT data or -1 if it is not set.
      • setSharedClassCacheSoftmxBytes

        boolean setSharedClassCacheSoftmxBytes​(long value)
        Set the shared class softmx size to value. The parameter specifies the softmx in bytes. See -Xscmx in the command line reference for additional details on the effect of setting shared class softmx.
        Parameters:
        value - new shared cache soft max value in bytes
        Returns:
        whether the requested operation has been completed.
        Throws:
        IllegalArgumentException - if input value value is less than 0.
        SecurityException - if a SecurityManager is being used and the caller does not have the ManagementPermission value of "control".
      • setSharedClassCacheMinAotBytes

        boolean setSharedClassCacheMinAotBytes​(long value)
        Set the minimum shared classes cache space reserved for AOT data to value bytes. See -Xscminaot in the command line reference for additional details on the effect of setting shared class -Xscminaot.
        Parameters:
        value - new -Xscminaot value in bytes
        Returns:
        whether the requested operation has been completed.
        Throws:
        IllegalArgumentException - if input value value is less than 0.
        SecurityException - if a SecurityManager is being used and the caller does not have the ManagementPermission value of "control".
      • setSharedClassCacheMaxAotBytes

        boolean setSharedClassCacheMaxAotBytes​(long value)
        Set the maximum shared classes cache space allowed for AOT data to value bytes. See -Xscmaxaot in the command line reference for additional details on the effect of setting shared class -Xscmaxaot.
        Parameters:
        value - new -Xscmaxaot value in bytes
        Returns:
        whether the requested operation has been completed.
        Throws:
        IllegalArgumentException - if input value value is less than 0.
        SecurityException - if a SecurityManager is being used and the caller does not have the ManagementPermission value of "control".
      • setSharedClassCacheMinJitDataBytes

        boolean setSharedClassCacheMinJitDataBytes​(long value)
        Set the minimum shared classes cache space reserved for JIT data to value bytes. See -Xscminjitdata in the command line reference for additional details on the effect of setting shared class -Xscminjitdata.
        Parameters:
        value - new -Xscminjitdata value in bytes
        Returns:
        whether the requested operation has been completed.
        Throws:
        IllegalArgumentException - if input value value is less than 0.
        SecurityException - if a SecurityManager is being used and the caller does not have the ManagementPermission value of "control".
      • setSharedClassCacheMaxJitDataBytes

        boolean setSharedClassCacheMaxJitDataBytes​(long value)
        Set the maximum shared classes cache space allowed for JIT data to value bytes. See -Xscmaxjitdata in the command line reference for additional details on the effect of setting shared class -Xscmaxjitdata.
        Parameters:
        value - new -Xscmaxjitdata value in bytes
        Returns:
        whether the requested operation has been completed.
        Throws:
        IllegalArgumentException - if input value value is less than 0.
        SecurityException - if a SecurityManager is being used and the caller does not have the ManagementPermission value of "control".
      • getSharedClassCacheSoftmxUnstoredBytes

        long getSharedClassCacheSoftmxUnstoredBytes()
        Returns the bytes which are not stored into the shared classes cache due to the current setting of softmx in shared classes.
        Returns:
        the unstored bytes.
      • getSharedClassCacheMaxAotUnstoredBytes

        long getSharedClassCacheMaxAotUnstoredBytes()
        Returns the bytes which are not stored into the shared classes cache due to the current setting of maximum space allowed for AOT data.
        Returns:
        the unstored bytes.
      • getSharedClassCacheMaxJitDataUnstoredBytes

        long getSharedClassCacheMaxJitDataUnstoredBytes()
        Returns the bytes which are not stored into the shared classes cache due to the current setting of maximum space allowed for JIT data.
        Returns:
        the unstored bytes.
      • getSharedClassCacheFreeSpace

        long getSharedClassCacheFreeSpace()
        Returns the free space in bytes of the cache that the JVM is currently connected to.
        Returns:
        the number of bytes free in the shared class cache.
      • getGCMode

        String getGCMode()
        Returns the current GC mode as a human-readable string.
        Returns:
        a String describing the mode the GC is currently operating in
      • getGCMasterThreadCpuUsed

        @Deprecated(forRemoval=true,
                    since="15")
        long getGCMasterThreadCpuUsed()
        Deprecated, for removal: This API element is subject to removal in a future version.
        renamed to getGCMainThreadCpuUsed
        Returns the amount of CPU time spent in the GC by the master thread, in milliseconds.
        Returns:
        CPU time used in milliseconds
      • getGCMainThreadCpuUsed

        long getGCMainThreadCpuUsed()
        Returns the amount of CPU time spent in the GC by the main thread, in milliseconds.
        Returns:
        CPU time used in milliseconds
      • getGCSlaveThreadsCpuUsed

        @Deprecated(forRemoval=true,
                    since="15")
        long getGCSlaveThreadsCpuUsed()
        Deprecated, for removal: This API element is subject to removal in a future version.
        renamed to getGCWorkerThreadsCpuUsed
        Returns the total amount of CPU time spent in the GC by all slave threads, in milliseconds.
        Returns:
        CPU time used in milliseconds
      • getGCWorkerThreadsCpuUsed

        long getGCWorkerThreadsCpuUsed()
        Returns the total amount of CPU time spent in the GC by all worker threads, in milliseconds.
        Returns:
        CPU time used in milliseconds
      • getMaximumGCThreads

        int getMaximumGCThreads()
        Returns the maximum number of GC worker threads.
        Returns:
        maximum number of GC worker threads
      • getCurrentGCThreads

        int getCurrentGCThreads()
        Returns the number of GC worker threads that participated in the most recent collection.
        Returns:
        number of active GC worker threads