Recent

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

dsiders

  • Full Member
  • ***
  • Posts: 212
[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 »
Lazarus 2.0.2 / FPC 3.0.4 / Windows 8.1 64-bit

wp

  • Hero Member
  • *****
  • Posts: 5824
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;
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

dsiders

  • Full Member
  • ***
  • Posts: 212
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.
Lazarus 2.0.2 / FPC 3.0.4 / Windows 8.1 64-bit

wp

  • Hero Member
  • *****
  • Posts: 5824
Re: [SOLVED] TCustomDBGrid memory leak?
« Reply #3 on: January 18, 2019, 11:14:25 pm »
Things like that happen to me all the time.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10