My application randomly returned OOM errors trying to allocate 16M chunks, while Linux had plenty memory used by disk cache (20G).
Swapping disabled. All OS limits seem fine.
After clearing Linux cache with drop_caches error disappeared.
Any idea what to check or is it somehow expected behavior?
malloc()can fail any time the OS can't find a way to give you the memory you asked for (this is *NOT* the same as "not enough memory to satisfy the request" - the two are just usually (99%+) coincident) If you want to know why the OS can't satisfy your memory request you'll have to jump into a kernel debugger - we can't tell you why without access to the specific system in question. Not being able to swap increases the likelihood of failures because the system can't free RAM by swapping, but if "No Swap" is a requirement for you you're pretty much back to a debugger... – voretaq7 Sep 18 '12 at 16:20