Results 1 to 2 of 2
Thread: mmap question
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Feb 2007
void TCMalloc_SystemRelease(void* start, size_t length)
void* newAddress = mmap(start, length, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
This function TCMalloc_SystemRelease() is supposed to release the memory back to the system, but it is calling mmap() function instead of free or delete. My understanding is that mmap is used to allocate the resources. That is it creates a new mapping in the virtual address space of the calling process.
Please can any one let me know is mmap can be used to release the memory back to the system also.
Sorry if I sound stupid
Thanks in advance
- Join Date
- Apr 2009
- I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
mmap() maps a system address to a local process address. The local process can use it, but cannot release it, other than releasing the local virtual address returned by mmap(). Usually one will use munmap() to do that. Anyway, read the manpage for mmap() for more information about these functions.Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!