[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: About memory allocation failures....
From: Kuba Ober <kuba () mareimbrium ! org>
Date: 2002-02-04 17:51:08
[Download RAW message or body]
On Monday 28 January 2002 06:02 pm, Carsten Pfeiffer wrote:
> On Montag, 28. Januar 2002 18:53, Schmidt, John wrote:
> > Testing the return on malloc SHOULD be a given.
I would like to see a good test case when you actually get that zero return
value for reasonably-sized malloc's (I'm not talking of multimegabyte things,
the usual tens-to-tens-of-thousands of bytes range). Did you ever get that
damned zero, and was able (your app was able) to do anything about it -
actually displaying a dialog box, or cleaning up nicely, or anything?????
> > Here's something good to dump (or NOT)... the amount of memory allocated
> > by the KDE process(es)...
>
> AFAIK, the C++ standard says that new should never return 0L, instead it
> should throw a bad_alloc exception. So checking for 0L might work on some
> compilers, but is hardly reliable.
Couldn't agree less.
An extension to that is that in many low-memory situation, the C/C++ library
will never get to return that 0L: it will get killed by the OOM killer first,
quite possibly, or will just be swapped out for a very long time (since
during low-memory conditions you get a lot of swap thrashing, and things take
ages anyway).
Cheerz, Kuba
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic