Re: Handling Out Of Memory
From: Bruce Roberts (ber_at_bounceitattcanada.xnet)
Date: 03/31/04
- Next message: Skybuck Flying: "Re: Safe pointer arithmetic and typecasts :D"
- Previous message: Bruce Roberts: "Re: Safe pointer arithmetic and typecasts :D"
- In reply to: Skybuck Flying: "Re: Handling Out Of Memory"
- Next in thread: Skybuck Flying: "Re: Handling Out Of Memory"
- Reply: Skybuck Flying: "Re: Handling Out Of Memory"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 31 Mar 2004 10:04:55 -0500
"Skybuck Flying" <nospam@hotmail.com> wrote in message
news:c4edjc$db3$1@news2.tilbu1.nb.home.nl...
> NO, RIGHT, VERY RIGHT :)
Very, very wrong. But before I go on, would you PLEASE clip your quotes. Its
quite annoying to have to scroll through the entire history to get to your
comments.
When writing support routines they should only ever handle a particular
exception if they can cope with it without affecting higher levels of code.
In my experience having any level of code unconditionally trap all
exceptions is very poor design. In the long run it just makes a program much
more difficult to maintain. In the short run it usually makes a program
(apparently) randomly unstable.
In the example being discussed a tree that runs out of memory can't continue
to function properly hence it can not continue to operate correctly which in
turn means that it can't cope with the exception transparently. IOW higher
levels of code must find out about the condition. So it makes absolutely no
sense for the tree to hide the condition from the code that uses it.
> I want to write an application that does know when memory is short and
that
> keeps functioning perfectly.
So write it such that it tests for available memory before attempting to
allocate it. And remember that the application is not the only active task
that needs memory. By the time an out of memory exception is raised it
generally far too late to perform any kind of graceful recovery.
- Next message: Skybuck Flying: "Re: Safe pointer arithmetic and typecasts :D"
- Previous message: Bruce Roberts: "Re: Safe pointer arithmetic and typecasts :D"
- In reply to: Skybuck Flying: "Re: Handling Out Of Memory"
- Next in thread: Skybuck Flying: "Re: Handling Out Of Memory"
- Reply: Skybuck Flying: "Re: Handling Out Of Memory"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|