Say I have a big block of mapped memory I finished using. It came from mmap
ing anonymous memory or using MAP_PRIVATE
. I could munmap
it, then have malloc
mmap
again the next time I make a big enough allocation.
Could I instead give the memory to malloc
directly? Could I say "Hey malloc
, here's an address range I mapped. Go use it for heap space. Feel free to mprotect
, mremap
, or even munmap
it as you wish."?
I'm using glibc on linux.