[PATCH v5] malloc: Mark pages with MADV_DONTNEED to shrink and grow rather than mremap()

William Hunt williamhuntdev@gmail.com
Fri Sep 5 14:50:45 GMT 2025


> Okay, then I think we need the check_may_shrink_heap there asa well.
Agreed. Only a subset of checks made for arenas should be used, those being 
whether the program is using secure mode and if memory has been overcommitted. 
I should make another function for the relevant checks for mmap'd chunks 
in the Linux sysdeps, which can then be called from check_may_shrink_heap(). 

As Wilco said in another reply, MADV_DONTNEED does not split the VMA, 
and does immediately reduce the RSS as shown by the tst-realloc-madvise test. 

> Is this with or without MTE active?
Without as Wilco said, if I need any extra checks when using MTE let me know. 

Interesting discussion about arenas, but those changes are for another patch. 

Kind regards,
William


More information about the Libc-alpha mailing list