> Has anyone considered the fact that malloc() never actually fails i.e. > memory starvation does not cause malloc() to return error. It always returns > true - when you actually access the memory one will get a SIGBUS (I think) > and the program will die. > > This behaviour (called overcommit) is to make the UNIX fork/exec model > efficient. For this reason one should use calloc() because at least then the > failure will occur close to the allocation call in the code.
Do you refer to the Linux and FreeBSD implementation? http://baus.net/memory-management http://www.ussg.iu.edu/hypermail/linux/kernel/0311.3/0420.html http://homepage.mac.com/mguthaus/tips/2005/tip050903.html > There have been many discussions about this quirk of malloc. The man page > even describes it as a bug ... To which manual do you refer to? Is it a similar version like this one? http://sman.informatik.htw-dresden.de:6711/man?=malloc Other specifications: - http://opengroup.org/onlinepubs/009695399/functions/calloc.html - http://docs.sun.com/app/docs/doc/816-5168/6mbb3hrgq?a=view Regards, Markus _______________________________________________ --Bandwidth and Colocation provided by Easynews.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev
