On Fri, 24 Dec 2004, Michalis Kamburelis wrote:

> Peter Vreman wrote:
> >>>This is because there is an extra (implicit) Try/Finally block.
> >>
> >>Thank you and Peter for answers. This way I was able to see how
> >>try...finally section looks in assembler :) Anyway, I understand that
> >>the answer is "can't be speed up". OK, I can live with that.
> >
> >
> > That is not correct. For your own code you can disable the implicit
> > exception frame with a directive:
> >
> >
> Indeed when I put {$IMPLICITEXCEPTIONS OFF} at the beginning of
> demo_resourcestring_slow.pas, Foo_Normal and Foo_ResourceString work
> equally fast. Nice, that's a solution in cases when I know that some
> code will not exit with exception.
> But I risk that if I ever call Foo_ResourceString(-1) that will raise
> exception from Foo_ResourceString, I can get memory leaks, right ?


> Or can I predict in certain cases that using {$IMPLICITEXCEPTIONS OFF} is
> safe (no memory leaks) even when procedure will raise some exceptions ?

In this particular case you will get memory leaks. As soon as an
ansistring is used, you will have problems.

> If the answer is yes, then maybe it's safe to compile parts of FPC
> sources in lists.inc (like TList.Get) inside {$IMPLICITEXCEPTIONS OFF} ?

Normally not.


fpc-devel maillist  -  fpc-devel@lists.freepascal.org

Reply via email to