Try to compile and run the following in Delphi XE with latest FastMM snapshot will show memory leak:
program Project1;
uses
FastMM4,
SysUtils;
procedure Test(a: TProc);
begin
end;
begin
Test(procedure begin end);
end.
Memory leak Report:
---------------------2011/12/16 12:36:46---------------------
A memory block has been leaked. The size is: 20
This block was allocated by thread 0x126C, and the stack trace (return addresses) at the time was:
403FA2
4048B7
407FC5
404DFE
4048EC
4151DE
74EE339A
770A9ED2
770A9EA5
The block is currently used for an object of class: Project2$283$ActRec
---------------------2011/12/16 12:36:46---------------------
This application has leaked memory. The small block leaks are (excluding expected leaks registered by pointer):
13 - 20 bytes: Project2$283$ActRec x 1
Note: Memory leak detail is logged to a text file in the same folder as this application. To disable this memory leak check, undefine "EnableMemoryLeakReporting".
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Try to compile and run the following in Delphi XE with latest FastMM snapshot will show memory leak:
program Project1;
uses
FastMM4,
SysUtils;
procedure Test(a: TProc);
begin
end;
begin
Test(procedure begin end);
end.
Memory leak Report:
---------------------2011/12/16 12:36:46---------------------
A memory block has been leaked. The size is: 20
This block was allocated by thread 0x126C, and the stack trace (return addresses) at the time was:
403FA2
4048B7
407FC5
404DFE
4048EC
4151DE
74EE339A
770A9ED2
770A9EA5
The block is currently used for an object of class: Project2$283$ActRec
The allocation number is: 107
Current memory dump of 256 bytes starting at pointer address 7EFA2660:
80 4D 41 00 01 00 00 00 E8 1A 40 00 F4 4C 41 00 00 00 00 00 85 B6 C6 A4 00 00 00 00 21 27 FA 7E
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5E 00 00 00 A2 3F 40 00 2B 59 40 00 10 5B 40 00
73 09 41 00 61 A0 40 00 F7 AF 40 00 24 B0 40 00 A2 3F 40 00 2B 59 40 00 2A 5B 40 00 73 09 41 00
6C 12 00 00 6C 12 00 00 BE 3F 40 00 4A 5A 40 00 7E 0C 41 00 0F 0E 41 00 57 29 41 00 87 51 41 00
24 55 40 00 90 55 40 00 E3 88 40 00 C4 51 41 00 9A 33 EE 74 10 00 00 00 B0 04 02 00 14 34 38 F9
58 E2 41 00 80 80 80 80 80 80 80 80 80 80 80 80 EB CB C7 06 80 80 80 80 00 00 00 00 01 29 FA 7E
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5F 00 00 00 A2 3F 40 00 2B 59 40 00 10 5B 40 00
73 09 41 00 61 A0 40 00 F7 AF 40 00 24 B0 40 00 A2 3F 40 00 2B 59 40 00 2A 5B 40 00 73 09 41 00
€ M A . . . . . è . @ . ô L A . . . . . … ¶ Æ ¤ . . . . ! ' ú ~
. . . . . . . . . . . . . . . . ^ . . . ¢ ? @ . + Y @ . . [ @ .
s . A . a @ . ÷ ¯ @ . $ ° @ . ¢ ? @ . + Y @ . * [ @ . s . A .
l . . . l . . . ¾ ? @ . J Z @ . ~ . A . . . A . W ) A . ‡ Q A .
$ U @ . U @ . ã ˆ @ . Ä Q A . š 3 î t . . . . ° . . . . 4 8 ù
X â A . € € € € € € € € € € € € ë Ë Ç . € € € € . . . . . ) ú ~
. . . . . . . . . . . . . . . . _ . . . ¢ ? @ . + Y @ . . [ @ .
s . A . a @ . ÷ ¯ @ . $ ° @ . ¢ ? @ . + Y @ . * [ @ . s . A .
---------------------2011/12/16 12:36:46---------------------
This application has leaked memory. The small block leaks are (excluding expected leaks registered by pointer):
13 - 20 bytes: Project2$283$ActRec x 1
Note: Memory leak detail is logged to a text file in the same folder as this application. To disable this memory leak check, undefine "EnableMemoryLeakReporting".
Hi,
Thanks for the report. That looks like a compiler bug, so I have filed this QC report:
Report No: 101846 Status: Reported
Anonymous methods declared in main program block of dpr leaks
http://qc.embarcadero.com/wc/qcmain.aspx?d=101846
In the meantime I suggest you declare anonymous methods outside of the main code block of the dpr in order to avoid this leak.
Best regards,
Pierre