ENOMEM failure on mmap call
Mulyadi Santosa
mulyadi.santosa at gmail.com
Thu Oct 13 00:02:21 EDT 2011
Hi :)
2011/10/12 Ezequiel García <elezegarcia at yahoo.com.ar>:
>> Initially, you requested 8 MB. Knowing that you had 9 MB
>> free RAM, I
>> think you got ENOMEM since that would just leave 1 MB and
>> quite likely
>> that is under safe minimum free RAM allowed. I roughly
>> recall that
>> somewhere around 2-5% of RAM must be kept unallocated from
>> user need
>> to cope with urgent situation or something like that.
>
> Okey, but I am not allocating since mmap won't consume any
> memory.
but you "commit"... and it is that "committed memory" that counts....
(in this situation IMO)
Also, i forgot to mention that it is likely to that your mmap failed
due to kernel inability to find such large continous virtual (let's
stress the word virtual here) memory area... it could be due to
fragmentation etc. So, IOW, physically kernel still able to satisfy
your request, but unable to map it for you.
>>
>> It was shown that, when you use 7.5 MB, that slight 0.5 MB
>> made you
>> didn't hit the mark...so you're safe now and kernel allow
>> that.
>
> But why does he allows 10 threads!!!
this is what I am not clear, do those 10 threads allocate 8 MB each?
or 8 MB total? remember that threads share address space by default...
>>
>> Sorry I couldn't point you to exact kernel source code
>> line.
>> lxr.linux.no is your best friend....
>>
>
> Thanks for the link and for the help. I guess I'll have
> to keep diggin :D
--
regards,
Mulyadi Santosa
Freelance Linux trainer and consultant
blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
More information about the Kernelnewbies
mailing list