Recent

Author Topic: Memory leaks  (Read 1834 times)

CanineQwer

  • New Member
  • *
  • Posts: 19
Memory leaks
« on: March 16, 2020, 09:37:50 pm »
I am using Lazarus 2.0.6 under Linux.
Give at least 1 reliable way to find memory leaks.
heaptrc crashes the program.
I heard about cmemtest, but I just can't find it.
* I'm testing on the simplest form with a button with a function
begin
  TButton.Create (nil);
end;

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10905
  • Debugger - SynEdit - and more
    • wiki
Re: Memory leaks
« Reply #1 on: March 16, 2020, 09:51:51 pm »
Use
  valgrind --tool=memcheck

You need to compile with "uses cmem". cmem must be the very first, in the uses clause of your main program.

Note, that this is going to run real slow.

You can load the output into: view > leaks and traces

CanineQwer

  • New Member
  • *
  • Posts: 19
Re: Memory leaks
« Reply #2 on: March 16, 2020, 11:03:55 pm »
Thank you, you helped me a lot.

 

TinyPortal © 2005-2018