Bart
if DebugHook <> 0 then begin
ReportMemoryLeaksOnShutdown := True;
SetMMLogFileName(PChar('Z:\Leaks\TfR.txt'));
Hmmm Debughook..
ie I only want leaks reporting when I developing and running from the IDE - I don't want them showing to the average user.
Okay, I have done this, and set the filename, but it is not created.
1. set TD32 on
Where do I find "TD32". I have see a reference to this before but I cannot find it. I may be blind...
TIn D2006 in alt-p-o-linker. I'd guess its "The 'debug information in separate TDS' file is checked"
2. enable the FullDebugMode compiler define in the FastMM4Options.inc file
All done...
If FastMM isn't produce a leaks file it may be that you don't have a leak. If there is one it may be in a dll, ocx or other linked piece of software.
Hah! I wish! Its packed with leaks, this is what i see in the default "ReportMemoryLeaksOnShutdown", but it does not show me WHERE they are...
Post the contents of the leaks file. I think you may be expecting more than FastMM will deliver. I just artificially created a leak by adding a stringlist and not freeing it
procedure TMainForm.FormCreate(Sender: TObject);
var
Cntr: integer;
qq:Tstringlist;
begin
qq:=tstringlist.create;
qq.add('aaa');
qq.add('bbb');
qq.add('ccc');
This is the contents of Z:\Leaks\TfR.txt
--------------------------------2018/3/16 15:23:51--------------------------------
A memory block has been leaked. The size is: 36
This block was allocated by thread 0xFC0, and the stack trace (return addresses) at the time was:
403075
489D0A [Classes][Classes][Classes.TStringList.SetCapacity]
489AA5 [Classes][Classes][Classes.TStringList.Grow]
489B6D [Classes][Classes][Classes.TStringList.InsertItem]
48981D [Classes][Classes][Classes.TStringList.AddObject]
4897C1 [Classes][Classes][Classes.TStringList.Add]
C621DE [Main.pas][Main][Main.TMainForm.FormCreate][716]
4D389F [Forms][Forms][Forms.TCustomForm.DoCreate]
4D355B [Forms][Forms][Forms.TCustomForm.AfterConstruction]
404CE4
4D3531 [Forms][Forms][Forms.TCustomForm.Create]
The block is currently used for an object of class: Unknown
The allocation number is: 103724
Current memory dump of 256 bytes starting at pointer address 7E4DA960:
00 27 66 7E 00 00 00 00 68 26 66 7E 00 00 00 00 D0 25 66 7E 00 00 00 00 80 80 80 80 80 80 80 80
06 A2 64 A0 80 80 80 80 00 00 00 00 31 A8 4D 7E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
D1 65 01 00 06 30 40 00 AF 48 40 00 76 4C 40 00 5B 53 4F 00 37 B3 49 00 82 A9 4E 00 53 28 4D 00
9C 35 4D 00 17 34 4D 00 E9 6C CC 76 91 6D CC 76 C0 0F 00 00 CD 48 40 00 24 6C 46 00 F5 74 48 00
13 49 40 00 DE AA 4E 00 DD 28 4D 00 33 38 4D 00 22 21 49 00 43 17 4D 00 A0 DB 46 00 A7 57 40 00
C0 0F 00 00 20 00 00 00 30 20 4E 00 83 1B DC 71 14 1E CE 00 80 80 80 80 80 80 80 80 80 80 80 80
80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 7C E4 23 8E 80 80 80 80 00 00 00 00 51 AC 4D 7E
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 D5 65 01 00 06 30 40 00 AF 48 40 00 76 4C 40 00
' f ~ . . . . h & f ~ . . . . Ð % f ~ . . . . .
¢ d . . . . 1 ¨ M ~ . . . . . . . . . . . . . . . ..
Ñ e . . . 0 @ . ¯ H @ . v L @ . [ S O . 7 ³ I . , © N . S ( M .
5 M . . 4 M . é l Ì v ' m Ì v À . . . Í H @ . $ l F . õ t H .
I @ . Þ ª N . Ý ( M . 3 8 M . " ! I . C . M . Û F . § W @ ..
À . . . . . . 0 N .
f . Ü q . . Î .
| ä # . . . . Q ¬ M ~
. . . . . . . . . . . . . . . Õ e . . . 0 @ . ¯ H @ . v L @ ..
--------------------------------2018/3/16 15:23:51--------------------------------
A memory block has been leaked. The size is: 68
This block was allocated by thread 0xFC0, and the stack trace (return addresses) at the time was:
403006
4048AF
404C76
4048E4
4763AA [SysUtils][SysUtils][SysUtils.TThreadLocalCounter.Recycle]
C621D0 [Main.pas][Main][Main.TMainForm.FormCreate][715]
4D389F [Forms][Forms][Forms.TCustomForm.DoCreate]
4D355B [Forms][Forms][Forms.TCustomForm.AfterConstruction]
404CE4
4D3531 [Forms][Forms][Forms.TCustomForm.Create]
76CC6CE9 [Unknown function at GetThreadDesktop]
The block is currently used for an object of class: TStringList
The allocation number is: 103723
Current memory dump of 256 bytes starting at pointer address 7E5741B0:
F0 41 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 60 A9 4D 7E 03 00 00 00
04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 67 63 63 07 80 80 80 80
80 80 80 80 80 80 80 80 00 00 00 00 61 40 57 7E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
32 95 01 00 06 30 40 00 AF 48 40 00 76 4C 40 00 E4 48 40 00 C6 22 C6 00 9F 38 4D 00 5B 35 4D 00
E4 4C 40 00 31 35 4D 00 E9 6C CC 76 91 6D CC 76 C0 0F 00 00 22 30 40 00 CD 48 40 00 24 6C 46 00
AF 97 48 00 13 49 40 00 21 63 C6 00 4D 40 4D 00 A6 84 4D 00 01 76 4D 00 F6 90 4E 00 96 5B 15 77
C0 0F 00 00 38 00 00 00 F0 41 48 00 AE 84 8B E9 14 1E CE 00 80 80 80 80 80 80 80 80 80 80 80 80
80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80
ð A H . . . . . . . . . . . . . . . . . . . . . ` © M ~ . . . .
. . . . . . . . . . . . . . . . . . . . . . . g c c . .
. . . . a @ W ~ . . . . . . . . . . . . . . . .
2 * . . . 0 @ . ¯ H @ . v L @ . ä H @ . Æ " Æ . 8 M . [ 5 M .
ä L @ . 1 5 M . é l Ì v ' m Ì v À . . . " 0 @ . Í H @ . $ l F .
¯ - H . . I @ . ! c Æ . M @ M . ¦ ,, M . . v M . ö N . - [ . w
À . . . 8 . . . ð A H . ® ,, < é . . Î .
--------------------------------2018/3/16 15:23:51--------------------------------
A memory block has been leaked. The size is: 12
This block was allocated by thread 0xFC0, and the stack trace (return addresses) at the time was:
403006
405A21
4059B4
489BAF [Classes][Classes][Classes.TStringList.InsertItem]
48981D [Classes][Classes][Classes.TStringList.AddObject]
4897C1 [Classes][Classes][Classes.TStringList.Add]
C621F6 [Main.pas][Main][Main.TMainForm.FormCreate][718]
4D389F [Forms][Forms][Forms.TCustomForm.DoCreate]
4D355B [Forms][Forms][Forms.TCustomForm.AfterConstruction]
404CE4
4D3531 [Forms][Forms][Forms.TCustomForm.Create]
The block is currently used for an object of class: AnsiString
The allocation number is: 103727
Current memory dump of 256 bytes starting at pointer address 7E6625C8:
01 00 00 00 03 00 00 00 63 63 63 00 13 32 F4 7A 00 00 00 00 A0 E5 65 7E 00 00 00 00 00 00 00 00
C4 C5 40 00 00 00 00 00 2E 95 01 00 06 30 40 00 21 5A 40 00 B4 59 40 00 AF 9B 48 00 1D 98 48 00
C1 97 48 00 EA 21 C6 00 9F 38 4D 00 5B 35 4D 00 E4 4C 40 00 31 35 4D 00 C0 0F 00 00 22 30 40 00
6D 59 40 00 64 5A 40 00 41 5B 40 00 EF 8B 48 00 9C 8A 48 00 F1 1F 96 00 BA 1A 96 00 27 63 48 00
AA 64 48 00 5E 34 4D 00 C0 0F 00 00 0C 00 00 00 00 00 00 00 58 EE CD 85 01 00 00 00 03 00 00 00
62 62 62 00 A7 11 32 7A 00 00 00 00 A0 E5 65 7E 00 00 00 00 00 00 00 00 C4 C5 40 00 00 00 00 00
2D 95 01 00 06 30 40 00 21 5A 40 00 B4 59 40 00 AF 9B 48 00 1D 98 48 00 C1 97 48 00 DE 21 C6 00
9F 38 4D 00 5B 35 4D 00 E4 4C 40 00 31 35 4D 00 C0 0F 00 00 22 30 40 00 96 59 40 00 4E 8C 48 00
. . . . . . . c c c . . 2 ô z . . . . å e ~ . . . . . . . ..
Ä Å @ . . . . . . * . . . 0 @ . ! Z @ . ´ Y @ . ¯ > H . .
~ H .
Á - H . ê ! Æ . 8 M . [ 5 M . ä L @ . 1 5 M . À . . . " 0 @ .
m Y @ . d Z @ . A [ @ . ï < H . S H . ñ . - . º . - . ' c H .
ª d H . ^ 4 M . À . . . . . . . . . . . X î Í ... . . . . . . . .
b b b . § . 2 z . . . . å e ~ . . . . . . . . Ä Å @ . . . . .
- * . . . 0 @ . ! Z @ . ´ Y @ . ¯ > H . .
~ H . Á - H . Þ ! Æ .
8 M . [ 5 M . ä L @ . 1 5 M . À . . . " 0 @ . - Y @ . N O H .
--------------------------------2018/3/16 15:23:51--------------------------------
A memory block has been leaked. The size is: 12
This block was allocated by thread 0xFC0, and the stack trace (return addresses) at the time was:
403006
405A21
4059B4
489BAF [Classes][Classes][Classes.TStringList.InsertItem]
48981D [Classes][Classes][Classes.TStringList.AddObject]
4897C1 [Classes][Classes][Classes.TStringList.Add]
C621EA [Main.pas][Main][Main.TMainForm.FormCreate][717]
4D389F [Forms][Forms][Forms.TCustomForm.DoCreate]
4D355B [Forms][Forms][Forms.TCustomForm.AfterConstruction]
404CE4
4D3531 [Forms][Forms][Forms.TCustomForm.Create]
The block is currently used for an object of class: AnsiString
The allocation number is: 103726
Current memory dump of 256 bytes starting at pointer address 7E662660:
01 00 00 00 03 00 00 00 62 62 62 00 A7 11 32 7A 00 00 00 00 A0 E5 65 7E 00 00 00 00 00 00 00 00
C4 C5 40 00 00 00 00 00 2D 95 01 00 06 30 40 00 21 5A 40 00 B4 59 40 00 AF 9B 48 00 1D 98 48 00
C1 97 48 00 DE 21 C6 00 9F 38 4D 00 5B 35 4D 00 E4 4C 40 00 31 35 4D 00 C0 0F 00 00 22 30 40 00
96 59 40 00 4E 8C 48 00 9C 8A 48 00 F1 1F 96 00 BA 1A 96 00 27 63 48 00 AA 64 48 00 5E 34 4D 00
E9 6C CC 76 91 6D CC 76 C0 0F 00 00 0C 00 00 00 00 00 00 00 40 14 E6 72 01 00 00 00 03 00 00 00
61 61 61 00 BF EB 19 8D 00 00 00 00 A9 27 66 7E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
74 B9 01 00 06 30 40 00 21 5A 40 00 05 61 40 00 66 AF 5A 00 ED AD 5A 00 6B E7 59 00 34 41 53 00
CA C0 54 00 1A 06 55 00 A7 9F 55 00 A7 B0 55 00 C0 0F 00 00 22 30 40 00 6D 59 40 00 6B 69 40 00
. . . . . . . b b b . § . 2 z . . . . å e ~ . . . . . . . ..
Ä Å @ . . . . . - * . . . 0 @ . ! Z @ . ´ Y @ . ¯ > H . .
~ H .
Á - H . Þ ! Æ . 8 M . [ 5 M . ä L @ . 1 5 M . À . . . " 0 @ .
- Y @ . N O H . S H . ñ . - . º . - . ' c H . ª d H . ^ 4 M .
é l Ì v ' m Ì v À . . . . . . . . . . . @ . æ r . . . . . . . .
a a a . ¿ ë . . . . . © ' f ~ . . . . . . . . . . . . . . . .
t ¹ . . . 0 @ . ! Z @ . . a @ . f ¯ Z . í Z . k ç Y . 4 A S .
Ê À T . . . U . § U . § ° U . À . . . " 0 @ . m Y @ . k i @ .
--------------------------------2018/3/16 15:23:51--------------------------------
A memory block has been leaked. The size is: 12
This block was allocated by thread 0xFC0, and the stack trace (return addresses) at the time was:
403006
405A21
4059B4
489BAF [Classes][Classes][Classes.TStringList.InsertItem]
48981D [Classes][Classes][Classes.TStringList.AddObject]
4897C1 [Classes][Classes][Classes.TStringList.Add]
C621DE [Main.pas][Main][Main.TMainForm.FormCreate][716]
4D389F [Forms][Forms][Forms.TCustomForm.DoCreate]
4D355B [Forms][Forms][Forms.TCustomForm.AfterConstruction]
404CE4
4D3531 [Forms][Forms][Forms.TCustomForm.Create]
The block is currently used for an object of class: AnsiString
The allocation number is: 103725
Current memory dump of 256 bytes starting at pointer address 7E6626F8:
01 00 00 00 03 00 00 00 61 61 61 00 BF EB 19 8D 00 00 00 00 A9 27 66 7E 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 74 B9 01 00 06 30 40 00 21 5A 40 00 05 61 40 00 66 AF 5A 00 ED AD 5A 00
6B E7 59 00 34 41 53 00 CA C0 54 00 1A 06 55 00 A7 9F 55 00 A7 B0 55 00 C0 0F 00 00 22 30 40 00
6D 59 40 00 6B 69 40 00 F5 68 40 00 83 49 40 00 C6 48 40 00 24 6C 46 00 B1 99 56 00 13 49 40 00
AD 95 5A 00 38 DA 54 00 C0 0F 00 00 0C 00 00 00 00 00 00 00 65 35 EF 84 14 1E CE 00 80 80 80 80
80 80 80 80 9A CA 10 7B 00 00 00 00 41 28 66 7E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
7A B9 01 00 06 30 40 00 21 5A 40 00 05 61 40 00 66 AF 5A 00 ED AD 5A 00 3B 24 55 00 34 41 53 00
A9 04 55 00 B7 9F 55 00 A7 B0 55 00 34 41 53 00 C0 0F 00 00 22 30 40 00 6D 59 40 00 6B 69 40 00
. . . . . . . a a a . ¿ ë . . . . . © ' f ~ . . . . . . . ..
. . . . . . . t ¹ . . . 0 @ . ! Z @ . . a @ . f ¯ Z . í Z ..
k ç Y . 4 A S . Ê À T . . . U . § U . § ° U . À . . . " 0 @ .
m Y @ . k i @ . õ h @ .
f I @ . Æ H @ . $ l F . ±
TM V . . I @ .
* Z . 8 Ú T . À . . . . . . . . . . . e 5 ï ,, . . Î .
Ê . { . . . . A ( f ~ . . . . . . . . . . . . . . . .
z ¹ . . . 0 @ . ! Z @ . . a @ . f ¯ Z . í Z . ; $ U . 4 A S .
© . U . · U . § ° U . 4 A S . À . . . " 0 @ . m Y @ . k i @ .
--------------------------------2018/3/16 15:23:51--------------------------------
This application has leaked memory. The small block leaks are (excluding expected leaks registered by pointer):
5 - 12 bytes: AnsiString x 3
21 - 36 bytes: Unknown x 1
53 - 68 bytes: TStringList 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".
The last bit give me an indication of what's leaking. Above that you can see C621DE [Main.pas][Main][Main.TMainForm.FormCreate][716] so I know where to look, the memory dump show the content (eg aaa)
If you need help deciphering the output please post the contents of the file.
Roy Lambert
Connect with Us