Re: A true story of a crash.

Albert D. Cahalan (acahalan@cs.uml.edu)
Mon, 17 Aug 1998 08:27:43 -0400 (EDT)


Michael Driscoll writes:
> [somebody wrote]

>> The argument FOR overcommitting memory is:
>>
>> Almost nobody check the malloc return values. And if they do,
>> all they do is bomb out with "out of memory". If you keep
>> such a process, it might even run to completion.
>
> There are people out there who don't check the return of malloc()?

Sure. Error checking is bloat. :-)

> Yuck. I've *always* made it a habit to define my own xmalloc()
> which bombs with an error messages on malloc() return of NULL.

As in the message you quoted, "all they do is bomb out".
That is, you didn't really handle the error. You crashed.

Note that printf() can return an error. Do you check that too?
Never check for an error you can't (or won't) handle.

If you actually would choose an alternate algorithm or save
critical data, you'd be right to check the return value.
I'd expect vi to handle failure in a useful manner instead
of just bombing out with an error message.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html