Excessive memory consumption when using malloc()
Thu Nov 25 18:21:25 GMT 2021
On 11/25/21 13:12, Konstantin Kharlamov via Libc-help wrote:
> So there you go, you 10G of unreleased memory is a Glibc feature, no complaints
Freeing memory back to the OS is a form of cache invalidation, and cache
invalidation is hard and workload dependent.
In this specific case, particularly with 50MiB, you are within the 64MiB
64-bit process heap size, and the 1024-byte frees do not trigger the
performance expensive consolidation and heap reduction (which requires
a munmap syscall to release the resources).
In the case of 10GiB, and 512KiB allocations, we are talking different
behaviour. I have responded here with my recommendations:
More information about the Libc-help