RFR: JDK-8296784: Provide clean mallinfo/mallinfo2 wrapper for Linux glibc platforms
Matthias Baesken
mbaesken at openjdk.org
Fri Nov 18 14:34:24 UTC 2022
On Thu, 10 Nov 2022 10:44:55 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
> This is a breakout from [JDK-8293114](https://bugs.openjdk.org/browse/JDK-8293114), which is starved for reviews. So I attempt to break up that fix into smaller units which are hopefully easier to review separately.
>
> We use the glibc-specific mallinfo/mallinfo2 APIs to query libc internals. These are quite important, since they are the only way to get the malloc load and retained size from the glibc allocator. NMT only reports a tiny part of that (only the user-view of whatever hotspot allocated).
>
> Using these APIs and staying glibc-agnostic requires some twiddling. This patch provides a clean wrapper to hide that twiddling from the end caller.
>
> Patch also fixes a display error that may have caused omission of the "may have wrapped" marker in the hs-err printout of the malloc load.
>
> Also, gtest regression test.
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 ?
src/hotspot/os/linux/os_linux.hpp
struct glibc_mallinfo {
size_t arena;
size_t ordblks;
size_t smblks;
size_t hblks;
size_t hblkhd;
size_t usmblks;
size_t fsmblks;
size_t uordblks;
size_t fordblks;
size_t keepcost;
};
src/hotspot/os/linux/os_linux.cpp
struct new_mallinfo {
size_t arena;
size_t ordblks;
size_t smblks;
size_t hblks;
size_t hblkhd;
size_t usmblks;
size_t fsmblks;
size_t uordblks;
size_t fordblks;
size_t keepcost;
};
-------------
PR: https://git.openjdk.org/jdk/pull/11088
More information about the hotspot-runtime-dev
mailing list