Recent

Author Topic: [solved] heaptrc mem leak tutorial  (Read 3688 times)

anonymousstranger

  • New Member
  • *
  • Posts: 49
[solved] heaptrc mem leak tutorial
« on: August 30, 2018, 08:10:48 pm »
Is there an updated and current tutorial on how to use heaptrc to find memory leaks (including setup)? All the tutorials I've been able to find use previous versions of lazarus, which renders them mostly unhelpful. If not, could someone help me with this? I'm using v1.8.4 with fpc 3.0.4 i386 win32/win64.
« Last Edit: August 30, 2018, 09:04:21 pm by anonymousstranger »

ASerge

  • Hero Member
  • *****
  • Posts: 2222
Re: heaptrc mem leak tutorial
« Reply #1 on: August 30, 2018, 08:25:34 pm »
...how to use heaptrc to find memory leaks (including setup)?
Project Options/Compiler Options/Debugger/Use Heaptrc unit (check for mem-leaks) (-gh)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: heaptrc mem leak tutorial
« Reply #2 on: August 30, 2018, 08:47:23 pm »
https://www.freepascal.org/docs-html/3.0.0/rtl/heaptrc/environment.html

You also may want to set a logfile (Menu Run > Run Param). You can then load the logfile *.trc in the "Leak and Traces" which you find in the view menu.

If you get memory corruption (rather than leaks), then also use keepreleased. Otherwise this is not needed.

On Linux, there is an alternative named valgrind. It is outside the IDE, and goes way beyond just leaks. But it needs some reading up.

anonymousstranger

  • New Member
  • *
  • Posts: 49
Re: heaptrc mem leak tutorial
« Reply #3 on: August 30, 2018, 09:03:40 pm »

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

 

TinyPortal © 2005-2018