On Fri, May 04, 2012 at 10:17:29AM +0900, Cedric BAIL wrote:
> On Thu, May 3, 2012 at 8:57 PM, Vincent Torri <vincent.to...@gmail.com> wrote:
> > is it normal that no check is done when calloc is called ?
> 
> It's a good question. In E17, there isn't much handling of this
> situation. I am wrong in assuming that on all unix supported by E17,
> when it start returning NULL, it would be way to late ?
> 
> Should we handle it ?

You should check for it and fail deterministically at least. Doing
something like fprintf(stderr, "oops\n"), exit(1); is perfectly valid.
When malloc and friends fail depends somewhat on the setup. Memory
overcommit makes the returned error unreliable in the sense that you can
later get killed by OOM. Using resource limits (ulimit -d / -v etc) can
result in malloc errors much earlier, but whether you can do something
sane from that depends on the circumstances. E.g. if the user wants to
open an image and you can't allocate a buffer, it makes sense to report
an error for that as the image and therefore the buffer can be huge.

Joerg

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to