heaptrc error, lazarus 1.6.4 lazarus / 12-Debugger ---------------------------------------------------------------------- mobilevil · 2017-06-19 10:24 hello, I am testing lazarus for a project and I found that heaptrc giving an error for me even on empty hello world program Heap dump by heaptrc unit 1116 memory blocks allocated:1674034/1677096 1116 memory blocks freed: 1674034/1677096 0 unfreed memory blocks:0 True heap size: 688128(112 used in System startup) True free heap:688016 seems 688016+112 = 688128... is it a real memory leak? I am using lazarus-1.6.4-fpc-3.0.2-win32.exe ---------------------------------------------------------------------- Pascal · 2017-06-19 10:34 No, everything is okay. ---------------------------------------------------------------------- Thaddy · 2017-06-19 10:35 Everything is OK. Heaptrace is a debugging tool. It also reports if nothing is wrong. It does not belong in release code, though. May be you are confused by this? True heap size: 688128(112 used in System startup) True free heap:688016 In that case 688016 + 112 = 688128.... ---------------------------------------------------------------------- mobilevil · 2017-06-19 10:44 Thanks! ---------------------------------------------------------------------- Ondrej Pokorny · 2017-06-20 11:35 You can use Code: [Select]  {$IF DECLARED(GlobalSkipIfNoLeaks)}   // don't show empty heaptrc output   GlobalSkipIfNoLeaks := True;   {$ENDIF} in yout LPR to disable the output of heaptrc if no memory leaks were detected. It works for recent FPC versions only (I don't remember in what stable version it was introduced, maybe it's only in trunk). ---------------------------------------------------------------------- avra · 2017-06-20 12:07 or something like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses  SharedLogger, ipcchannel, filechannel, uniqueinstanceraw {...} ; // use multilog and UniqueInstance for convenience const  LOG_FILENAME           = 'debug.log';  LOG_OLD_FILENAME         = 'debug.old.log';  LOG_START_CMD_FILENAME   = 'debug.run';  TRACE_FILENAME           = 'trace.log';  TRACE_OLD_FILENAME       = 'trace.old.log';  TRACE_START_CMD_FILENAME = 'trace.run'; begin  if InstanceRunning then  begin // Another application instance is already running    UseHeapTrace := false;    Exit;  end;  HaltOnError := false; // do not stop application on heap error   if FileExists(TRACE_START_CMD_FILENAME) then  begin // send heap info to file instead of showing it on app exit    DeleteFile(TRACE_OLD_FILENAME);    RenameFile(TRACE_FILENAME, TRACE_OLD_FILENAME);    SetHeapTraceOutput(TRACE_FILENAME);  end  else    GlobalSkipIfNoLeaks := true; // when not tracing to file, we want trace dialog to show only if there are leaks   if FileExists(LOG_START_CMD_FILENAME) then  begin // switch on file logging    DebugToFile := true;    DeleteFile(LOG_OLD_FILENAME);    RenameFile(LOG_FILENAME, LOG_OLD_FILENAME);    Logger.Channels.Add(TFileChannel.Create(LOG_FILENAME));  end;  Logger.Channels.Add(TIPCChannel.Create); // switch on ipc logging  Logger.Send('----------------------------------------------------');  Logger.SendHeapInfo('MyApplication heap on program start');   Application.Initialize;  { ... create forms }  Application.Run;   Logger.SendHeapInfo('Heap on program finish');  Logger.SendCallStack('Call stack');end. ---------------------------------------------------------------------- Pascal · 2017-06-20 12:26 Quote from: Ondrej Pokorny on June 20, 2017, 01:35:11 pm(I don't remember in what stable version it was introduced, maybe it's only in trunk). Was added to fixes_3_0 on 31.5.2016