Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.


Welcome, Guest
Guest Settings
Help

Thread: Delphi 10.2.3: What tools to trace memory leaks?


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 13 - Last Post: Mar 18, 2018 12:40 AM Last Post By: Roy Lambert
Bart Kindt

Posts: 33
Registered: 12/16/07
Delphi 10.2.3: What tools to trace memory leaks?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 14, 2018 11:25 PM
Using Delphi 10.2.3.

What is the best tool for me to trace memory leaks?

Thanks, Bart

---
Bart Kindt
CEO & Developer
SARTrack Limited New Zealand
http://www.sartrack.nz

Bernd Maierhofer

Posts: 161
Registered: 9/27/99
Re: Delphi 10.2.3: What tools to trace memory leaks?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 14, 2018 11:59 PM   in response to: Bart Kindt in response to: Bart Kindt
What is the best tool for me to trace memory leaks?

Besides, what FastMM offers for free:

https://smartbear.com/product/aqtime-pro/features-x/delphi-profiling/
https://www.nexusdb.com/support/index.php?q=node/27156

The latter is my favourite.

HTH Bernd
Alex Belo

Posts: 626
Registered: 10/8/06
Re: Delphi 10.2.3: What tools to trace memory leaks?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 15, 2018 4:13 AM   in response to: Bernd Maierhofer in response to: Bernd Maierhofer
Bernd Maierhofer wrote:

What is the best tool for me to trace memory leaks?

Besides, what FastMM offers for free:

https://smartbear.com/product/aqtime-pro/features-x/delphi-profiling/
https://www.nexusdb.com/support/index.php?q=node/27156

Also take a look into the madExcept:

http://www.madshi.net/madExceptDescription.htm

--
Alex
Bart Kindt

Posts: 33
Registered: 12/16/07
Re: Delphi 10.2.3: What tools to trace memory leaks?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 15, 2018 1:44 PM   in response to: Bernd Maierhofer in response to: Bernd Maierhofer
I just installed FastMM.

I followed all instructions, also installed the FastMM4 Options program, set everything to max Debug, copied the DLL in place, added the FastMM at the top of the program, even set a {$INCLUDE FastMM4Options.inc} in the dpr.
In the project Options, I have set the Debug Information, Use Debug DCU's, and in Linker the Map file to Detailed.
The 'debug information in separate TDS' file is checked.
To keep things simple, I compile in 32 bit mode.

The program works perfectly... But I do NOT get ANY type of Debug information, either while running or after closing.
The file "Leaks_MemoryManager_EventLog.txt" is NOT generated.

When I set the Delphi option ReportMemoryLeaksOnShutdown := true; then I get a window full with leaks, but no additional information from FastMM.

What am I doing wrong? Is FastMM not compatible with Delphi 10.2.3?

Bart

--
---
Bart Kindt
CEO & Developer
SARTrack Limited New Zealand
http://www.sartrack.nz

Roy Lambert

Posts: 40
Registered: 10/21/99
Re: Delphi 10.2.3: What tools to trace memory leaks?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 16, 2018 1:11 AM   in response to: Bart Kindt in response to: Bart Kindt
Bart

This is what I have in my D2006 dpr

if DebugHook <> 0 then begin
ReportMemoryLeaksOnShutdown := True;
SetMMLogFileName(PChar('Z:\Leaks\TfR.txt'));
{
1. set TD32 on
2. enable the FullDebugMode compiler define in the FastMM4Options.inc file
}
end;

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.

Roy Lambert
Bart Kindt

Posts: 33
Registered: 12/16/07
Re: Delphi 10.2.3: What tools to trace memory leaks?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 16, 2018 1:36 AM   in response to: Roy Lambert in response to: Roy Lambert
if DebugHook <> 0 then begin
ReportMemoryLeaksOnShutdown := True;
SetMMLogFileName(PChar('Z:\Leaks\TfR.txt'));

Hmmm Debughook..

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...

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...

Thanks, Bart

---
Bart Kindt
CEO & Developer
SARTrack Limited New Zealand
http://www.sartrack.nz

Edited by: Bart Kindt on Mar 16, 2018 9:50 PM
Roy Lambert

Posts: 40
Registered: 10/21/99
Re: Delphi 10.2.3: What tools to trace memory leaks? [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 16, 2018 8:35 AM   in response to: Bart Kindt in response to: Bart Kindt
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

Bart Kindt

Posts: 33
Registered: 12/16/07
Re: Delphi 10.2.3: What tools to trace memory leaks? [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 16, 2018 1:45 PM   in response to: Roy Lambert in response to: Roy Lambert
Roy Lambert wrote:

If you need help deciphering the output please post the contents of the file.

Thanks for the example, at least I now have an idea what it will look like.
IF I can get FastMM to generate any file. Which it does not.
I am now hacking in the source code, and added a log-to-file system in it to see what is going on.
For example, the SetMMLogFileName does not seem to have any effect. When I check the result of the procedure which sets the filename to use, it is still its default filename.
That is fine, but despite all that, NO file is created.

My little Log file shows this:

RunInitializationCode Start: DelphiIsRunning=TRUE DebugHook=1
RunInitializationCode: after ifdefs
FASTMM: RunInitializationCode
InitializeMemoryManager: FullDebugMode (is set)
InitializeMemoryManager: CheckHeapForCorruption (is set)

InitializeMemoryManager: calling SetDefaultMMLogFileName
SetDefaultMMLogFileName: LEnvVarLength=0; MMLogFileName=C:\Users\Bart\Documents\Embarcadero\Studio\Projects\SARTrack Server DEV\Win32\Debug\SARTrackServer_MemoryManager_EventLog.txt
SetDefaultMMLogFileName: END: MMLogFileName=C:\Users\Bart\Documents\Embarcadero\Studio\Projects\SARTrack Server DEV\Win32\Debug\SARTrackServer_MemoryManager_EventLog.txt

The file is NOT generated.

I will try to add more Log entries at various places to see why it does not work.

bart
---
Bart Kindt
CEO & Developer
SARTrack Limited New Zealand
http://www.sartrack.nz
Roy Lambert

Posts: 40
Registered: 10/21/99
Re: Delphi 10.2.3: What tools to trace memory leaks? [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 17, 2018 2:48 AM   in response to: Bart Kindt in response to: Bart Kindt
Bart

I can't help much because I'm still opn D2006 so it may be incompatibilities with 10.2.3 or a permissions thing. However, one thing I would try is creating a simpler directory path eg C:\Leaks and setting

SetMMLogFileName(PChar('C:\Leaks\SARTrack.txt'));

I use Z:\Leaks for all my projects (separate file name for each) and have no problem with the files being created

Roy Lambert

Bart Kindt

Posts: 33
Registered: 12/16/07
Re: Delphi 10.2.3: What tools to trace memory leaks? [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 17, 2018 12:45 PM   in response to: Roy Lambert in response to: Roy Lambert
Roy Lambert wrote:
Bart

I can't help much because I'm still opn D2006 so it may be incompatibilities with 10.2.3 or a permissions thing. However, one thing I would try is creating a simpler directory path eg C:\Leaks and setting

SetMMLogFileName(PChar('C:\Leaks\SARTrack.txt'));


As I said, as far as I can see, the command SetMMLogFileName does not work either. It still shows the original path/filename. Regardless, no file is created in either location.

Roy Lambert

--
---
Bart Kindt
CEO & Developer
SARTrack Limited New Zealand
http://www.sartrack.nz
Roy Lambert

Posts: 40
Registered: 10/21/99
Re: Delphi 10.2.3: What tools to trace memory leaks? [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 18, 2018 12:40 AM   in response to: Bart Kindt in response to: Bart Kindt
Bart

I can't help much because I'm still opn D2006 so it may be incompatibilities with 10.2.3 or a permissions thing. However, one thing I would try is creating a simpler directory path eg C:\Leaks and setting

SetMMLogFileName(PChar('C:\Leaks\SARTrack.txt'));

As I said, as far as I can see, the command SetMMLogFileName does not work either. It still shows the original path/filename. Regardless, no file is created in either location.

Since I don't have your environment I can't do much here. From previous comments I assume you have the source for FastMM4 so why not make sure its included for debugging and set a breakpoint where the file should be written?

In the change log comments in my version (4.97) I found

<< Version 4.92 (25 November 2008):
- Added the DisableLoggingOfMemoryDumps option under FullDebugMode. When
this option is set, memory dumps will not be logged for memory leaks or
errors. (Thanks to Patrick van Logchem.)
- Exposed the class and string type detection code in the interface section
for use in application code (if required). (Requested by Patrick van
Logchem.)
- Fixed a bug in SetMMLogFileName that could cause the log file name to be
set incorrectly.>>

I'd suggest a breakpoint at the start of the following procedures

procedure DeleteEventLog;
procedure AppendEventLog(ABuffer: Pointer; ACount: Cardinal);
procedure SetDefaultMMLogFileName;
procedure SetMMLogFileName(ALogFileName: PAnsiChar = nil);

That should allow you to see what's happening.

Roy Lambert
Ian Branch

Posts: 442
Registered: 9/23/99
Re: Delphi 10.2.3: What tools to trace memory leaks?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 17, 2018 2:55 AM   in response to: Bart Kindt in response to: Bart Kindt
Hi Bart,
What's the OS you are developong on? Wouldn't be Win 10 by any chance?

Regards,
Ian
Bart Kindt

Posts: 33
Registered: 12/16/07
Re: Delphi 10.2.3: What tools to trace memory leaks?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 17, 2018 12:46 PM   in response to: Ian Branch in response to: Ian Branch
Ian Branch wrote:
Hi Bart,
What's the OS you are developong on? Wouldn't be Win 10 by any chance?

No, Windows 8.1 and Delphi 10.2.3.

Bart


Regards,
Ian

--
---
Bart Kindt
CEO & Developer
SARTrack Limited New Zealand
http://www.sartrack.nz
Ian Branch

Posts: 442
Registered: 9/23/99
Re: Delphi 10.2.3: What tools to trace memory leaks?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 17, 2018 1:34 PM   in response to: Bart Kindt in response to: Bart Kindt
K. Not my thinking then.
Cheers,
Ian
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02