View Issue Details

IDProjectCategoryView StatusLast Update
0007281FPCCompilerpublic2007-01-01 20:41
ReporterInoussa OUEDRAOGO Assigned ToFlorian  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Fixed in Version2.2.0 
Summary0007281: Memory leak with interfaces
DescriptionThe attached progam demonstrates a interface memory leak which is not present in 2.0.2.
The problem is also present in the 2.1.1

It seems that it occured when a interface is passed as procedure parameter like this :

  proc1(TTest.Create() as ITest);
Additional Information1- When the program is compiled with 2.0.2, the results are :
[listing 2.0.2]
Creating >>> 544436
 called in test
Creating >>> 544468
 called in proc1
Destroying >>> 544468
Destroying >>> 544436
Remaining instances ... 0
[/listing 2.0.2]

1- When the program is compiled with 2.0.2, the results are :
[listing 2.0.2]
Creating >>> 544436
 called in test
Creating >>> 544468
 called in proc1
Destroying >>> 544468
Destroying >>> 544436
Remaining instances ... 0
[/listing 2.0.2]

2- When the program is compiled with 2.0.4.rc3, the results are :
[listing 2.0.4.rc3]
Creating >>> 675784
 called in test
Creating >>> 676072
 called in proc1
Destroying >>> 676072
Remaining instances ... 1
[/listing 2.0.4.rc3]

and the "HeapTrc" unit output are

[HeapTrc]
E:\Inoussa\Sources\lazarus\tests\interfaces\test_intf.exe
Heap dump by heaptrc unit
53 memory blocks allocated : 987/1192
52 memory blocks freed : 971/1176
1 unfreed memory blocks : 16
True heap size : 196608 (208 used in System startup)
True free heap : 196304
Should be : 196328
Call trace for block $000A4FC8 size 16
 $00402608 TOBJECT__NEWINSTANCE, line 177 of
C:/lazarus/source/fpcbuild/2.0.4-rc3/fpcsrc/rtl/inc/objpas.inc
 $00401B3E TINTERFACEDOBJECT__NEWINSTANCE, line 705 of
C:/lazarus/source/fpcbuild/2.0.4-rc3/fpcsrc/rtl/inc/objpas.inc
 $004010CA TTEST__CREATE, line 33 of test_intf.pas
 $004012C0 TEST, line 53 of test_intf.pas
 $0040133F main, line 58 of test_intf.pas
 $004013EE EXE_ENTRY, line 420 of system.pp
[/HeapTrc]

TagsNo tags attached.
Fixed in Revision4998
FPCOldBugId
FPCTarget
Attached Files

Relationships

related to 0007209 closedFlorian Memory problem with Zeos Access 

Activities

2006-08-18 22:10

 

test_intf.pas (1,001 bytes)

Issue History

Date Modified Username Field Change
2006-08-18 22:10 Inoussa OUEDRAOGO New Issue
2006-08-18 22:10 Inoussa OUEDRAOGO File Added: test_intf.pas
2006-10-22 10:13 Florian Relationship added related to 0007209
2006-10-22 10:14 Florian Fixed in Revision => 4998
2006-10-22 10:14 Florian Status new => resolved
2006-10-22 10:14 Florian Fixed in Version => 2.1.1
2006-10-22 10:14 Florian Resolution open => fixed
2006-10-22 10:14 Florian Assigned To => Florian
2007-01-01 20:41 Florian Status resolved => closed