On Wed, 11 Jan 2023 14:49:59 GMT, Thomas Stuefe <stu...@openjdk.org> wrote:
> Curious, I always thought we do ArrayAllocator - using mmap for larger > allocations - to prevent memory retention for libc variants whose allocators > are "grabby", i.e. which don't promptly return memory to the OS on free(). > E.g. because they only use sbrk (Solaris, AIX), or are just cautious about > returning memory (glibc). > > Glibc's retention problem is only relevant for fine-grained allocations, so > for glibc this is probably fine. This leaves at least AIX as a potential > problem. @backwaterred, does the AIX libc malloc() still exclusively use the > data segment ? Does free'd memory still stick to the process? > > (While writing this, I remember that we at SAP even rewrote Arena allocation > to use mmap for AIX, because large compile arenas caused lasting RSS > increase, so it has definitely been a problem in the past) Correct, glibc always mmap's allocations above a certain limit and always unmaps them on free. I believe most implementations do that, either immediately unmapping or using madvise. AIX still uses sbrk, based on their documentation that I could find. Though AIX does have something called [malloc disclaim](https://www.ibm.com/docs/en/aix/7.2?topic=subsystem-malloc-disclaim). ------------- PR: https://git.openjdk.org/jdk/pull/11931