[fpc-devel] Managed Types, Undefined Bhaviour
Thorsten Engler
thorsten.engler at gmx.net
Fri Jun 29 19:28:20 CEST 2018
> -----Original Message-----
> From: fpc-devel <fpc-devel-bounces at lists.freepascal.org> On Behalf Of
> Michael Van Canneyt
> Sent: Saturday, 30 June 2018 03:11
> To: FPC developers' list <fpc-devel at lists.freepascal.org>
> Subject: Re: [fpc-devel] Managed Types, Undefined Bhaviour
>
>
> Please explain. Exactly how does it demonstrate this ?
>
> What is the expected output ?
> And how does current output differ from expected output ?
The same code results in more calls to AddRef/Release under FPC than it does under Delphi.
The executed code in FPC is still "correct", in that the reference count reaches 0 (and the object is freed) late enough. So there is no issue with "correctness".
But the additional redundant calls to AddRef/Release will execute lock inc/dec or add/sub instructions. Which are very expensive.
More information about the fpc-devel
mailing list