Recent

Author Topic: [SOLVED] TCustomDBGrid memory leak?  (Read 1328 times)

dsiders

  • Hero Member
  • *****
  • Posts: 1084
[SOLVED] TCustomDBGrid memory leak?
« on: January 18, 2019, 10:40:50 pm »
Lazarus 1.8.4
 
I noticed that TCustomDBGrid does not free the TBookmarkList it uses for SelectedRows. It was created in the constructor though. Seems to violate the whole "clean up after yourself" principle for resource allocation.

Seems like a memory leak to me. Checked the bugtracker, but did not find anything related.

Comments?
« Last Edit: January 18, 2019, 10:52:41 pm by dsiders »
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

wp

  • Hero Member
  • *****
  • Posts: 11922
Re: TCustomDBGrid memory leak?
« Reply #1 on: January 18, 2019, 10:47:33 pm »
Really?

Code: Pascal  [Select][+][-]
  1. destructor TCustomDBGrid.Destroy;
  2. begin
  3.   {$ifdef dbgGrid}DebugLn('%s.Destroy', [ClassName]); {$endif}
  4.   FSelectedRows.Free;                 // <------------------------- Destroyed here !!!
  5.   FDataLink.OnDataSetChanged:=nil;
  6.   FDataLink.OnRecordChanged:=nil;
  7.   FDataLink.Free;
  8.   inherited Destroy;
  9. end;

dsiders

  • Hero Member
  • *****
  • Posts: 1084
Re: TCustomDBGrid memory leak?
« Reply #2 on: January 18, 2019, 10:52:21 pm »
Really?

That was a very polite way of pointing out that I am either blind or an idiot. My eyesight is pretty good, so let's go with the latter. ;)

Thanks.
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

wp

  • Hero Member
  • *****
  • Posts: 11922
Re: [SOLVED] TCustomDBGrid memory leak?
« Reply #3 on: January 18, 2019, 11:14:25 pm »
Things like that happen to me all the time.

 

TinyPortal © 2005-2018