I have been called on to write a "Partial Free" function for previously allocated virtual memory. EG, someone allocated a large block of memory with mmap(), and now they want to free a section *out of the middle or end* of it.
My reading of the POSIX munmap doc https://pubs.opengroup.org/onlinepubs/7908799/xsh/munmap.html is that munmap does this already, because it deallocates "pages" not previous allocations, and I only need to call munmap() with the requested-deallocated range (assuming the range to be page-aligned)
Correct?
@mcc i've seen glibc on linux turn malloc into "mmap a large block and munmap the last about half of it", so yes that's a common usage pattern. the munmap took most of the time.