RFR: JDK-8296784: Provide clean mallinfo/mallinfo2 wrapper for Linux glibc platforms

Thomas Stuefe stuefe at openjdk.org
Fri Nov 18 14:50:06 UTC 2022


On Fri, 18 Nov 2022 14:31:57 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

> Hello, besides the little typos already mentioned looks okay.
> But is there really a need to have both structs with same variables/types in it ?

Hi Matthias,

thanks for looking at this.

Both structures have different purposes, though:

- `glibc_mallinfo` in os_linux.hpp holds the output of the JVM internal API `os::Linux::get_mallinfo()`. Its members are large enough to hold the output from both `mallinfo()` and `mallinfo2()`
- `new_mallinfo`, locally in os_linux.cpp, is the output for the glibc function "mallinfo2()". It is defined to make the JVM *buildable* on systems with older glibc, but still *runnable* on a system with a newer glibc. It needs to be binary-compatible with the official glibc "mallinfo2" output structure.

Yes, both are identical, and I considered just using one structure. The old version did this. But I would have to make sure that they are binary compatible and always stay that way too. In the end, I decided to just create separate structures, it seemed less effort, and more obvious to the code reader.

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

PR: https://git.openjdk.org/jdk/pull/11088


More information about the hotspot-runtime-dev mailing list