Re: Possible memory leak?
On Jul 21, 7:07 pm, Juha Nieminen <nos...@thanks.invalid> wrote:
khalid...@gmail.com wrote:
Does this mean that having an exception thrown without being
caught causes a memory leak ?
Exceptions should always be caught. If an exception is thrown
out of main(), bad things can happen (at least with some
compilers and systems).
Such as? The behavior of an uncaught exception is defined by
the standard, and I'm not aware of any compilers which have
problems in this regard.
(OTOH I find it strange that it would leak anything. The stack
should be unwound normally even if it's the main() function.)
If the exception is not caught, it is unspecified whether the
stack is unwound or not---I think that typically, it isn't, so
you still have the information as to where the exception was
thrown in your core dump.
Of course, under a well behaved operating system, nothing leaks,
even if a process terminates abnormally.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34