-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Isn't the traditional solution to pre-allocate an emergency pad, and when malloc fails the emergency "I need more memory" handler gets to use that pad, and then propagates the condition upwards until some caller can handle the case?

Or should I run out and file a patent?

Paul

On 9-Jun-06, at 4:38 PM, David Leimbach wrote:

On 6/9/06, Ronald G Minnich <[email protected]> wrote:
Latchesar Ionkov wrote:
> Another example is using emalloc in libraries. I agree that it is much > simpler to just give up when there is not enough memory (which is also
> not very likely case), but is that how the code is supposed  to be
> written if you are not doing research?

yes, that is a problem with a lot of code. "Just bail on first error" --
we've had to stop using emalloc here because that is very unrealistic
for production support.

ron


Well I wonder what people typically do when they can't malloc anymore
memory but need more... A reasonable thing to do is to die I'd think.

In fact if you use Perl "die" is even a part of the lang.

my $a = 5 or die;
print "hello, world\n" or die;

^^ Valid, "draconian" perl?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFEighzpJeHo/Fbu1wRAtb8AJ45qe4fxgEIiZrpugkheL+V14GHDgCfRd7b
GkIT818+hgPefaxcI25OvaA=
=KZnc
-----END PGP SIGNATURE-----

Reply via email to