[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: Small patch to aid use of lib dmalloc



On 07/12/10 11:55, Peter Clifton wrote:
On Tue, 2010-12-07 at 00:48 +0000, Peter Clifton wrote:
On Tue, 2010-12-07 at 10:04 +1100, Stephen Ecob wrote:

Dropping the (a) ? (a) : 1 foolishness would be cleaner, but could
expose latent bugs in the 71 callers of the mymem allocators.
I'm happy to proceed either way.  What is your preference ?

Let me push a big patch nuking the My* allocation functions, that would
make me feel much happier.

Damnit, MyMalloc does some other "helpful" things, like checking for a
memory allocation failure and aborting with a useful diagnostic message.

I'd be pretty happy to drop the messages (as it is not such a common
occurrence), but I do note that the changes I'm about to propose will
change a known handled failure path with a nice error message and
termination, to retuning a NULL pointer which is then probably used,
"probably" followed by segfault.

On Linux at least, "malloc" will tend to always succeed rather than
returning out of memory.

You could wrap malloc so that it does a longjmp to the start of the
program where the error is displayed then exits. Gracefully handling
malloc failures is too tedious and itself bug-prone, so just design
the program so that they should never happen, given an adequte amount
of memory.


_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user