RFR: JDK-8301749: Tracking malloc pooled memory size

Thomas Stuefe stuefe at openjdk.org
Wed Feb 8 13:27:45 UTC 2023


On Wed, 8 Feb 2023 13:15:17 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

> > return -1.
> > You aim to mimic the malloc_info() API at os:: level, so you should return -1 in case malloc_info failed, including failure do to resolving issues.
> 
> Wouldn't that lead to a caller not knowing whether `malloc_info` itself failed or if our wrapper failed? 

Why would that matter?

> `malloc_info` also sets `errno`. I think it's better if we don't imitate `malloc_info`, by returning `-2` if `malloc_info` is missing, to distinguish the different states.

We kind of follow this style in a lot of the wrappers we have in os::. As it is now, your malloc_info is neither here nor there - looks and mostly behaves like malloc_info, but not completely. I'd either be consistent and return -1, or convert this to a clearly named wrapper function which should return bool.

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

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


More information about the hotspot-runtime-dev mailing list