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

List:       kde-pim
Subject:    Re: [Kde-pim] out of memory
From:       Don Sanders <sanders () kde ! org>
Date:       2005-05-27 1:42:29
Message-ID: 200505271142.29258.sanders () kde ! org
[Download RAW message or body]

On Friday 27 May 2005 02:02, André Wöbbeking wrote:
> On Thursday 26 May 2005 16:02, David Faure wrote:
> > On Thursday 26 May 2005 15:32, Mark Bucciarelli wrote:
> > > In C, I'm used to checking that malloc returns a non-null
> > > pointer to make sure you app is not out of memory.
> > >
> > > How do you do this in C++?
> >
> > This was discussed some time ago, and the consenssus was that in
> > KDE code, we don't check for out of memory, and we don't need to.
> > The system gets unusable much before the entire swap is used, and
> > before it gets to that point, the OOM killer will kill processes
> > as an attempt to recover anyway; and if not, the user will have
> > rebooted his machine anyway, tired of waiting for the GUI to
> > respond again. So there isn't much point in bloating up the code
> > with out-of-memory checks that will never happen, or that won't
> > make any difference when they happen.
>
> so it's better a application or the whole system crashes instead of
> an error dialog "Sorry, too large document..."?

We had a discussion on the KMail list recently. Where I think we 
didn't disagree that it would be an ok idea to check that there's 
enough memory to complete an action before executing it, e.g. fail 
gracefully and just show a not enough memory dialog if the user tries 
to attach a 1 gig file to a mail.

> If the overhead for C++ exceptions is really negligible with newer
> compilers it's probably time to reconsider the decision if
> exceptions should be used or not.

I agree with Reinhold. Unfortunately exceptions aren't truly useful 
for handling out of memory in C++ programs. As David said (I agree 
with everything David said) the appropriate place is in some OOM 
killer.

Don Sanders.
_______________________________________________
kde-pim mailing list
kde-pim@kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic