Call trace for block $1196BCB0 size 23
$006FE26E ESCAPE, line 126 of C:/data/lazdev/LazXXX/OPM/packages/zeosdbo/src/core/ZURL.pas
$006FE8A9 TZURL__SETDATABASE, line 229 of C:/data/lazdev/LazXXX/OPM/packages/zeosdbo/src/core/ZURL.pas
$006E32DB TZABSTRACTCONNECTION__SETDATABASE, line 398 of C:/data/lazdev/LazXXX/OPM/packages/zeosdbo/src/component/ZAbstractConnection.pas
$0043EF1C TFORMMAIN__STARTUP, line 1251 of frmmain.pas
$0043E114 TFORMMAIN__FORMACTIVATE, line 291 of frmmain.pas
$0041F338 TCUSTOMFORM__ACTIVATE, line 680 of ./include/customform.inc
$0041F79B TCUSTOMFORM__CMACTIVATE, line 842 of ./include/customform.inc
$0040E9F1
$0052704B TWINCONTROL__WNDPROC, line 5419 of ./include/wincontrol.inc
$00420C2B TCUSTOMFORM__WNDPROC, line 1477 of ./include/customform.inc
$0052FC14 TCONTROL__PERFORM, line 1581 of ./include/control.inc
$00426852 TSCREEN__SETFOCUSEDFORM, line 899 of ./include/screen.inc
$0042315B TCUSTOMFORM__SETFOCUSEDCONTROL, line 2556 of ./include/customform.inc
$00526E69 TWINCONTROL__WNDPROC, line 5347 of ./include/wincontrol.inc
$005BF94E DELIVERMESSAGE, line 112 of lclmessageglue.pas
$0050ECA1 TWINDOWPROCHELPER__DOWINDOWPROC, line 2511 of ./win32/win32callback.inc
Call trace for block $11934218 size 27
$006FE26E ESCAPE, line 126 of C:/data/lazdev/LazXXX/OPM/packages/zeosdbo/src/core/ZURL.pas
$006FE7F9 TZURL__SETHOSTNAME, line 214 of C:/data/lazdev/LazXXX/OPM/packages/zeosdbo/src/core/ZURL.pas
$006E325B TZABSTRACTCONNECTION__SETHOSTNAME, line 378 of C:/data/lazdev/LazXXX/OPM/packages/zeosdbo/src/component/ZAbstractConnection.pas
$0043EEFE TFORMMAIN__STARTUP, line 1251 of frmmain.pas
$0043E114 TFORMMAIN__FORMACTIVATE, line 291 of frmmain.pas
$0041F338 TCUSTOMFORM__ACTIVATE, line 680 of ./include/customform.inc
$0041F79B TCUSTOMFORM__CMACTIVATE, line 842 of ./include/customform.inc
$0040E9F1
$0052704B TWINCONTROL__WNDPROC, line 5419 of ./include/wincontrol.inc
$00420C2B TCUSTOMFORM__WNDPROC, line 1477 of ./include/customform.inc
$0052FC14 TCONTROL__PERFORM, line 1581 of ./include/control.inc
$00426852 TSCREEN__SETFOCUSEDFORM, line 899 of ./include/screen.inc
$0042315B TCUSTOMFORM__SETFOCUSEDCONTROL, line 2556 of ./include/customform.inc
$00526E69 TWINCONTROL__WNDPROC, line 5347 of ./include/wincontrol.inc
$005BF94E DELIVERMESSAGE, line 112 of lclmessageglue.pas
$0050ECA1 TWINDOWPROCHELPER__DOWINDOWPROC, line 2511 of ./win32/win32callback.inc
Call trace for block $1196BF30 size 23
$006FE26E ESCAPE, line 126 of C:/data/lazdev/LazXXX/OPM/packages/zeosdbo/src/core/ZURL.pas
$006FE9C9 TZURL__SETPASSWORD, line 249 of C:/data/lazdev/LazXXX/OPM/packages/zeosdbo/src/core/ZURL.pas
$006E335B TZABSTRACTCONNECTION__SETPASSWORD, line 418 of C:/data/lazdev/LazXXX/OPM/packages/zeosdbo/src/component/ZAbstractConnection.pas
$0087875B TDMSQLCON__DATAMODULECREATE, line 300 of C:/data/Nope/hugo/common/dmconnection_sql.pas
$0047156D
$00471492
$00878669 GETCONNECTIONSQLG16H, line 280 of C:/data/Nope/hugo/common/dmconnection_sql.pas
$0043EED9 TFORMMAIN__STARTUP, line 1251 of frmmain.pas
$0043E114 TFORMMAIN__FORMACTIVATE, line 291 of frmmain.pas
$0041F338 TCUSTOMFORM__ACTIVATE, line 680 of ./include/customform.inc
$0041F79B TCUSTOMFORM__CMACTIVATE, line 842 of ./include/customform.inc
$0040E9F1
$0052704B TWINCONTROL__WNDPROC, line 5419 of ./include/wincontrol.inc
$00420C2B TCUSTOMFORM__WNDPROC, line 1477 of ./include/customform.inc
$0052FC14 TCONTROL__PERFORM, line 1581 of ./include/control.inc
$00426852 TSCREEN__SETFOCUSEDFORM, line 899 of ./include/screen.inc
Call trace for block $1196ABB0 size 17
$006FE26E ESCAPE, line 126 of C:/data/lazdev/LazXXX/OPM/packages/zeosdbo/src/core/ZURL.pas
$006FE939 TZURL__SETUSERNAME, line 239 of C:/data/lazdev/LazXXX/OPM/packages/zeosdbo/src/core/ZURL.pas
$006E331B TZABSTRACTCONNECTION__SETUSER, line 408 of C:/data/lazdev/LazXXX/OPM/packages/zeosdbo/src/component/ZAbstractConnection.pas
$0087874B TDMSQLCON__DATAMODULECREATE, line 299 of C:/data/Nope/hugo/common/dmconnection_sql.pas
$0047156D
$00471492
$00878669 GETCONNECTIONSQLG16H, line 280 of C:/data/Nope/hugo/common/dmconnection_sql.pas
$0043EED9 TFORMMAIN__STARTUP, line 1251 of frmmain.pas
$0043E114 TFORMMAIN__FORMACTIVATE, line 291 of frmmain.pas
$0041F338 TCUSTOMFORM__ACTIVATE, line 680 of ./include/customform.inc
$0041F79B TCUSTOMFORM__CMACTIVATE, line 842 of ./include/customform.inc
$0040E9F1
$0052704B TWINCONTROL__WNDPROC, line 5419 of ./include/wincontrol.inc
$00420C2B TCUSTOMFORM__WNDPROC, line 1477 of ./include/customform.inc
$0052FC14 TCONTROL__PERFORM, line 1581 of ./include/control.inc
$00426852 TSCREEN__SETFOCUSEDFORM, line 899 of ./include/screen.inc
I think calling uniquestring from passed const parameters is duplicate code... result is a copy anyway.No, its not.
The most likely is that you included the heaptrc unit yourself: you should not. You should select the option in Lazarus or compile with FPC with the -gh command-line option.Heaptrace is only invoked by Lazarus via the Option menu.
It is highly unlikely(actually nay impossible) that heaptrace returns false positives, because it is a memory manager that registers use and free.
Even the silly UniqueString that you use should not matter.
The line that they all have in common isThe line is
TFORMMAIN__STARTUP, line 1251 of frmmain.pas
so that would be the next bit to examine.
SQL.HostName:= coConnection; // <<------------------
But that is not on the same line as the call to "SetHostname".Code: [Select]$006E32DB TZABSTRACTCONNECTION__SETDATABASE, line 398 of C:/data/lazdev/LazXXX/OPM/packages/zeosdbo/src/component/ZAbstractConnection.pas
$0043EF1C TFORMMAIN__STARTUP, line 1251 of frmmain.pas
Call trace for block $11934218 size 27
That might be the size of your hostname string (including header). 13 chars, possible 12 bytes header (not sure, see "TAnsiRec"), one terminating #0 == 26. Not sure where the 1 byte diff comes from, and only if TAnsiRec 12 bytes.
UniqueString(Result); // Not necessary P := Pointer(Result);// this points to the wrong location: the string descriptor part
Question: Is the leak list in your first post complete?No, it is not complete. It is a very, very long heaptrace file and Lazarus need a lot of time to create it. But this was the first (on top of the file) and not clear issue (for me).
Result := ReplaceChar(#9, ';', Result);The value returned by ReplaceChar is assigned to the same variable that is passed in as "Str".
All this does not matter, because the next is UniqueString(Result).So Result and Str in ReplaceChar are the same string (pointing to the same memory).
function ReplaceChar(const Source, Target: Char; const Str: string): string; begin Result := Str;
But then
Result := Str;
modifies Result (decrease the ref count of the old value). And by that it modifies "Str". But Str is const, and therefore you are not allowed to modify it.
All this does not matter, because the next is UniqueString(Result).And if at that point "Str" is a dangling pointer, then how does that help.
In both cases, after the dec-ref, str is a dangling pointer.If everything worked so badly, it would really be a problem :). FPC work fine.
In that case probably look further down in the list.You are right, i worked on the list BOTTOM UP and found a leak in my factory, after close this leak, it works as expected and don't claim the 'positive false'.
If you leak some object, that often leaks other data.