Recent

Author Topic: TCHMHelpDatabase+TLHelpConnector memory leaks  (Read 1624 times)

Mr.Madguy

  • Hero Member
  • *****
  • Posts: 627
TCHMHelpDatabase+TLHelpConnector memory leaks
« on: October 11, 2018, 02:44:43 pm »
So, my project works perfectly. Only one thing left - cross-platform help. I wanted to add LHelp.exe support to my program - the same help viewer, Lazarus itself uses. It works properly, but heaptrc reports several memory leaks in LazHelpCHM and LHelpControl, when I close my application, if I show any help. I've done everything according to this article and \lazarus\components\chmhelp\democontrol\ContextHelpDemo demo project. This project also causes exactly the same memory leaks. Do I miss something? Or it's known bug?

Windows 7 Pro 64bit
Lazarus 1.8.4 + FPC 3.0.4 64bit
« Last Edit: October 11, 2018, 02:50:35 pm by Mr.Madguy »
DynamicData 3.0 is released!
4.0 version is in development! Another complete overhaul! Things are made more simple and, of course, faster!
Aiming at Lazarus support, when closures will be implemented.

wp

  • Hero Member
  • *****
  • Posts: 8097
Re: TCHMHelpDatabase+TLHelpConnector memory leaks
« Reply #1 on: October 11, 2018, 03:08:55 pm »
It looks to me that TLHelpConnector (unit LazHelpCHM) creates the internal FConnection in TLHelpConnectonr.ShowHelp, but does not destroy it any more.

It helps for me to add this destructor:
Code: Pascal  [Select][+][-]
  1. destructor TLHelpConnector.Destroy;
  2. begin
  3.   FConnection.Free;
  4.   inherited;
  5. end;

Please modify LazHelpCHM this way, recompile the lhelpcontrolpkg and test. If it works for you, too, I'll apply this to trunk.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

Mr.Madguy

  • Hero Member
  • *****
  • Posts: 627
Re: TCHMHelpDatabase+TLHelpConnector memory leaks
« Reply #2 on: October 11, 2018, 03:20:25 pm »
It looks to me that TLHelpConnector (unit LazHelpCHM) creates the internal FConnection in TLHelpConnectonr.ShowHelp, but does not destroy it any more.

It helps for me to add this destructor:
Code: Pascal  [Select][+][-]
  1. destructor TLHelpConnector.Destroy;
  2. begin
  3.   FConnection.Free;
  4.   inherited;
  5. end;

Please modify LazHelpCHM this way, recompile the lhelpcontrolpkg and test. If it works for you, too, I'll apply this to trunk.

Yeah, it works. Thanks.
DynamicData 3.0 is released!
4.0 version is in development! Another complete overhaul! Things are made more simple and, of course, faster!
Aiming at Lazarus support, when closures will be implemented.

wp

  • Hero Member
  • *****
  • Posts: 8097
Re: TCHMHelpDatabase+TLHelpConnector memory leaks
« Reply #3 on: October 11, 2018, 03:30:35 pm »
Fixed in r59289. Will be in Laz 2.0.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

 

TinyPortal © 2005-2018