[fpc-devel] Managed Types, Undefined Bhaviour

Michael Van Canneyt michael at freepascal.org
Fri Jun 29 16:18:04 CEST 2018

On Fri, 29 Jun 2018, Michael Van Canneyt wrote:

> On Fri, 29 Jun 2018, Martok wrote:
>> Am 29.06.2018 um 14:41 schrieb Michael Van Canneyt:
>>> As far as I can see, you get 2 chain and 1 done call. Which is what I'd 
> expect.
>>> The overrides of the _* calls are useless, since they are not virtual in
>>> TInterfacedObject and hence never called. So that's OK too.
>> Interface functions are always virtual and implemented by the actually
>> instantiated class.

> The "override" keyword is neither allowed nor needed, this
>> code does what it looks like.
>> The expected output would be 3 Addrefs and 3 Releases.
> I don't get that.

Pressed send too quickly.

home:~> ./tirc 
Chain: 00007FA5948CF040
Chain: 00007FA5948CF040
Done: 00007FA5948CF040

is the complete output. So either your explanation is wrong, or the compiler
completely faulty.

Compiling with memleak detection:

home:~> fpc -glh tirc.pp
home:~> ./tirc
Chain: 00007F6FA90280C0
Chain: 00007F6FA90280C0
Done: 00007F6FA90280C0

Heap dump by heaptrc unit of /home/michael/tirc
1 memory blocks allocated : 32/32
1 memory blocks freed     : 32/32
0 unfreed memory blocks : 0
True heap size : 32768
True free heap : 32768


More information about the fpc-devel mailing list