The Delphi Bug List

Entry No.
640
VCL - Win32 - ComCtrls - THeaderControl
Each instance of THeaderControl leaks memory
1.02 2.01 3.0 3.01 3.02 4.0 4.01 4.02 4.03 5.0 5.01 6.0 6.01 6.02 Kylix 1.0
N/AAbsentAbsentAbsentAbsentAbsentAbsentAbsentAbsentExistsExistsFixedFixedFixedN/A
Description
Reported by Colin Wilson; checked by Jordan Russell
There's a memory leak in THeaderControl that shows up with MemorySleuth, etc.

It happens any time you use the THeaderControl (Win32) component.

In the THeaderControl constructor there's a line...

  FImageChangeLink := TChangeLink.Create;

But the FImageChangeLink is never 'Free'd - in the destructor or anywhere else.

Note from checker:
The amount of memory leaked appears to be 16 bytes.

User-contributed comments
BigBro
30 Aug 2001  01:26 AM GMT
From http://www.automatedqa.com/support/leaksd5.asp

File: comctrls.pas
Procedure: THeaderControl.Destroy
After a call to THeaderControl.Create, the THeaderControl class forgets to free the FImageChangeLink object.

Workaround

destructor THeaderControl.Destroy;
begin
  FCanvas.Free;
  FSections.Free;

  //Add following line
  FImageChangeLink.Free;

  if Assigned(FSectionStream) then FSectionStream.Free;
  inherited Destroy;
end;
cygnum al'kaizen
08 Aug 2006  09:19 AM GMT
i added the line to freeup FChangeImageList in the destructor of this object, but the leak still persists. any more ideas?
Latest update of this entry: 2001-06-19

Post a comment on this bug


Index page
Delphi Bug List home page
The Delphi Bug Lists are presently maintained by Jordan Russell, who has taken over this task from Reinier Sterkenburg since August 2000.
All feedback is appreciated. See also the feedback section of the Delphi Bug List home page.