When shrinking a mmap based allocation, we can just unmap the trailing pages that will no longer be needed. When extending an allocation we try to MMAP_FIXED_NOREPLACE the need extra data to avoid memcpy between old and new allocation. I'm not sure if the extension logic is really worth it but it is just 15 lines of code to avoid possibly very large memcpys.
14 KiB
14 KiB