DragDrop0400 memory leak
- From: Jacques Melancon <jmelancon@xxxxxxxxxxxxx>
- Date: Mon, 05 Mar 2007 11:51:40 -0500
I started using the Drag & drop component suite 4.00
by Anders Melander which works fine.
However, I also use FastMM4 which reports a memory leak
for each drag operation. The report looks like this
-----------------------------------------------------------
A memory block has been leaked. The size is: 20
Stack trace of when this block was allocated (return addresses):
4029CF [System][@GetMem]
403907 [System][TObject.NewInstance]
403CCE [System][@ClassCreate]
479AAE [DragDrop.pas][DragDrop][TClipboardFormats.Create][905]
403910 [System][TObject.NewInstance]
4653F7 [DropSource.pas][DropSource][TEnumFormatEtc.Create][960]
465A58 [DropSource.pas][DropSource][TCustomDropMultiSource.GetEnumFormatEtc][1166]
464ABB [DropSource.pas][DropSource][TCustomDropSource.EnumFormatEtc][480]
775334F5 [OleUninitialize]
The block is currently used for an object of class: TClipboardFormats
-----------------------------------------------------------
Now looking at the source, I found that the TEnumFormatEtc
class has a field "FFormats" of type TClipboardFormats which is
created by the constructor, but there is no Destroy method for
that class.
It seems that simply adding the following destructor
destructor TEnumFormatEtc.Destroy;
begin
FFormats.Free;
inherited;
end;
patches the leak but I'm not sure at all of what I'm doing because TEnumFormatEtc is declared as:
TEnumFormatEtc = class(TInterfacedObject, IEnumFormatEtc)
...
end;
and I never play with interfaces.
Anybody can confirm that what I'm doing is ok?
TIA,
Jacques
.
- Prev by Date: Re: Another Castalia 5/Delphi 2007 preview video
- Next by Date: Re: Another Castalia 5/Delphi 2007 preview video
- Previous by thread: Castalia 5/Delphi 2007 videos #4 and 5
- Next by thread: Turbopower Orpheus
- Index(es):
Relevant Pages
|