Results 1 to 1 of 1
Thread: mmap running out of memory
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Feb 2011
mmap running out of memory
i have a library which uses mmap to map big files into memory. At some point, mmap fails with ENOMEM. And from what i understand, mmap uses kernel memory which is limited per system (not per process).
I have some questions related to this...
1. How can i know the system limit of memory available to mmap?
I think it is setrlimit(2) with RLIMIT_AS - can you pls confirm if that is true?
2. How can i know the current usage of this memory? I want to fallback to malloc/read as soon as a certain threshold is passed (i.e. 75% of the available memory).