[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:54:24
[Download RAW message or body]

On Monday 28 January 2002 07:14 pm, Rodolfo Conde Martinez wrote:
> On Monday 28 January 2002 23:02, Carsten Pfeiffer wrote:
> > On Montag, 28. Januar 2002 18:53, Schmidt, John wrote:
> > > Testing the return on malloc SHOULD be a given.
> > > 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.
>
> 	mmmhh.....havent check all the kde code....but isnt it free of exception
> checking (as it does code bigger and slower doesnt it ?? )....and i guess
> not all compilers have the -fno-check-new and -fno-exceptions like g++, so
> if there isnt exception checking what happens ? the program just crashes
> ??? wouldnt be a good idea to set a function handler in the kdelibs maybe
> or a handler apropiated for each app ??

In linux (at least), in a typical low-memory, high-load, kde usage scenarios, 
by the time you check for memalloc(x) == 0, you don't exist anymore - the 
process is killed. It's that simple. Code that never executes is useless and 
should be removed, damn it - that's the whole point, right? Nobody in his 
sane mind would include a ton of useless code in an application, and such 
checks are no less, no more, useless code. I'd love everyone to get over with 
this idea. For certain large allocations there's a point in checking, 
otherwise there's none...

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