RFR: 8263185: Mallinfo deprecated in glibc 2.33 [v2]

Thomas Stuefe stuefe at openjdk.java.net
Sun Mar 14 05:23:16 UTC 2021


On Fri, 12 Mar 2021 22:07:20 GMT, Christoph Göttschkes <cgo at openjdk.org> wrote:

>> Starting with glibc 2.33, mallinfo is deprecated in favor of the new mallinfo2 API. Both APIs work the same way, the only difference is, that mallinfo2 uses size_t instead of int for the fields of the struct, containing the information about malloc. Please see the [glibc release notes](https://sourceware.org/pipermail/libc-alpha/2021-February/122207.html).
>> 
>> Testing with tier1 on a system with glibc 2.33 and on a system with glibc 2.31.
>
> Christoph Göttschkes has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fixes sign extension regression and resolves mallinfo using dlsym.

Hi Christoph,

this looks fine in principle, but could you please move the symbol resolution to the init phase? There are plenty of examples, e.g. `os::Linux::sched_getcpu_init`, `os::Linux::libnuma_init`. (They are all exposed via the os::Linux namespace which I personally don't like but when in Rome...)

The main reason for this is that `os::Linux::print_process_memory_information` may be called during error reporting, in the context of a crash, and I don't want to call as little system APIs as possible there.

BTW, you can also test this with -XX:ErrorHandlerTest=*number*, with e.g. 14 I believe giving you a real SEGV. The information should be printed correctly as part of the hs-err file.

Also please use CAST_TO_FN_PTR instead of manually casting. In general, its good to keep to the existing style wrt to C++ features. For one, we have a list of allowed and disallowed list of C++ features, which is not immediately clear (see hotspot style guide in top level doc folder). And I personally don't like mixing styles, better to change code to more modern C++ syntax in specific RFEs if that is wanted. Also makes backporting functional changes easier.

Thanks, Thomas

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

Changes requested by stuefe (Reviewer).

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


More information about the hotspot-runtime-dev mailing list