Recent

Author Topic: tools for memory leak detection.  (Read 1778 times)

BSaidus

  • Hero Member
  • *****
  • Posts: 540
  • lazarus 1.8.4 Win8.1 / cross FreeBSD
tools for memory leak detection.
« on: February 17, 2019, 08:38:44 pm »
Hi.
Using heaptrc is good but when using cmem instead the heaptrc report 0/0 memory leaks.
So, is there any ways or technics to detect memory leaks when using cmem.
I found http://drmemory.org/, but I want your advices.

Thanks.
lazarus 1.8.4 Win8.1 / cross FreeBSD
dhukmucmur vernadh!

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9792
  • Debugger - SynEdit - and more
    • wiki
Re: tools for memory leak detection.
« Reply #1 on: February 17, 2019, 11:20:01 pm »
If you are on linux: valgrind

BSaidus

  • Hero Member
  • *****
  • Posts: 540
  • lazarus 1.8.4 Win8.1 / cross FreeBSD
Re: tools for memory leak detection.
« Reply #2 on: February 18, 2019, 07:50:41 am »
If you are on linux: valgrind
No, windows
lazarus 1.8.4 Win8.1 / cross FreeBSD
dhukmucmur vernadh!

Thaddy

  • Hero Member
  • *****
  • Posts: 14203
  • Probably until I exterminate Putin.
Re: tools for memory leak detection.
« Reply #3 on: February 18, 2019, 11:25:48 am »
If your application is fully functional with heaptrc you should debug with heaptrc.
If heaptrc reports no leaks, cmem will also have no leaks by extension. This is for the majority of cases: heaptrc is not meant for release code anyway.

You can also hook the cmem memory manager functions with e.g. https://github.com/MahdiSafsafi/DDetours/blob/master/Source/DDetours.pas and write your own logger.
(you can even hook the low level windows heap management functions)

Another option is AppVerifier from the windows SDK.
« Last Edit: February 18, 2019, 11:29:37 am by Thaddy »
Specialize a type, not a var.

 

TinyPortal © 2005-2018