[fpc-devel] MemoryLeak with AS Operator

Helmut Hartl helmut.hartl at firmos.at
Fri Jul 21 09:46:10 CEST 2006

In testing upcoming 2.0.4 release i found an incompatibility/memory 
leak which is present in fpc versions greater 2.0.2.

I tested faulty against

2.0.3 fixes svn
2.1.1 head svn
2.0.4 rc2 branch svn

Working OK with 2.0.2 Release.

The following code runs differently on compiler versions greater 2.0.2

function TTestCollection.Add(const 
         Item:IInterface): Integer; begin
FList^[0] := Item as IInterface; // (1)
//FList^[0] := Item;  // (2)


(1) => Original Code  No Memory Leak with FPC=2.0.2 but with > 2.0.2
(2) => No Memory Leak 

Reported with a demo program as Bug 7174.

I post this to the list, as i spent the whole night on searching this
and maybe it helps someone out.



More information about the fpc-devel mailing list