Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2006-07

MemoryLeak with AS Operator

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Helmut Hartl

Hello,
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)
end;

(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.
http://www.freepascal.org/mantis/bug_view_advanced_page.php?bug_id=7174

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

Greets,

helmut

Reply by email