Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8302128

Tracking malloc pooled memory size

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 21
    • hotspot
    • minimal
    • Other
    • JDK

      Summary

      Add a JCmd, System.native_heap_info, to output malloc_info(3) on GNU/Linux systems.

      Problem

      While the JVM has tools such as NMT for reporting statistics on allocations done through the runtime, the internals of glibc's malloc has been opaque. As memory committed by malloc but not used by the application can take up significant parts of the RSS this is a problem. The user cannot investigate the state of malloc, and therefore cannot take appropriate action. Specifically, the JCmd System.trim_native_heap typically has the effect of reducing the RSS significantly in situations where large but mostly empty arenas are kept around by malloc. Currently, it is difficult for the user to recognise these situations.

      Solution

      By exposing malloc_info(3) through JCmd the user can now easily gain access to more information regarding the RSS. malloc_info(3) outputs detailed data in an XML format for processing and analysis. .

      Specification

      diff --git a/closed/src/jdk.jcmd/share/man/jcmd.md b/closed/src/jdk.jcmd/share/man/jcmd.md
      index 430663a71a..980107a104 100644
      --- a/closed/src/jdk.jcmd/share/man/jcmd.md
      +++ b/closed/src/jdk.jcmd/share/man/jcmd.md
      @@ -586,6 +586,13 @@ The following commands are available:
      
           Impact: Low --- no impact
      
      +`System.native_heap_info` (Linux only)
      +:   Prints information about native heap usage through malloc_info(3).
      +
      +    Impact: Low
      +
      +    Permission: `java.lang.management.ManagementPermission(monitor)`
      +
       `System.trim_native_heap` (Linux only)
       :   Attempts to free up memory by trimming the C-heap.

            jsjolen Johan Sjölen
            rehn Robbin Ehn
            David Holmes
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: