[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: About memory allocation failures....
From:       Rodolfo Conde Martinez <rcm () gmx ! co ! uk>
Date:       2002-02-05 1:14:04
[Download RAW message or body]

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

On Monday 04 February 2002 17:54, Kuba Ober wrote:
> 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...
>
	I was saying this because the C++ standard defines functions for some 
exception handling and defines functions for setting these functions, for 
exception thrown by new theres a set_new_handler (correct me if im wrong) 
function, for unexpected exceptions theres set_unexpected and some 
others....but yes if you cant give the user a messagebox at least to tell him 
in a 'beautyfull' :) way that the program comes down maybe theres no point 
for setting handlers....but maybe for those big allocations it would make 
sense......


	Cheers....



- -- 
rcm.
rcm@gmx.co.uk
GPG Public Key: http://ada.fciencias.unam.mx/~rconde/rodolfo_gpg.txt
ICQ 118193727
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8XzHfx2Sktruwba0RApXWAJ9J1upmSyYlHPVg9yk0ClUhzPzLOgCgxKLH
imYO3CuMcMeR7Yiz260ZU6A=
=uYR4
-----END PGP SIGNATURE-----


>> 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