I plan to use mmap() to allocate a buffer close to a specific address.
What I’m worried about is, the buffer allocated using mmap() will overlap other buffers allocated by malloc() or new operator (C++). Is it possible?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, that does not happen.
The heap maintained by the
mallocfunction lives in virtual mappings that have been established viabrkormmap, so memory areas could only be reused if the kernel gave out the same block viammaptwice.