RFR: JDK-8286198: [linux] Fix process-memory information

Thomas Stuefe stuefe at openjdk.java.net
Thu May 5 15:03:56 UTC 2022


We use mallinfo/mallinfo2 to obtain information about the glibc used memory, but there is an error which causes it to be correct only for fine granular malloc allocations. glibc puts larger allocations in mmap-allocated areas, which were missing from the old calculation.

This patch fixes that; it also adds information about memory retained in the glibc after free. Note that the latter unfortunately does not follow glibc trims because trimming is done AFAIK with madvice(MADV_DONTNEED) which does not seem to affect glibc internal bookkeeping. Still its a very valuable thing to know in order to estimate glibc overhead especially in fine granular mass allocation scenarios.

Tests: Lots of manual tests with various malloc loads and granularities, in addition to automated tests.

-------------

Commit messages:
 - fix process memory information on linux

Changes: https://git.openjdk.java.net/jdk/pull/8553/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8553&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8286198
  Stats: 7 lines in 1 file changed: 3 ins; 0 del; 4 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8553.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8553/head:pull/8553

PR: https://git.openjdk.java.net/jdk/pull/8553


More information about the hotspot-runtime-dev mailing list