info2004 wrote: > I have a mixture of components dropped onto the form, and some > created by a thread. > > The thread ones I free in the thread destructor,#
Note that components that shall run in worker thread context have to be created in the Execute method of TThread. Good practice is to destroy them at the end of method Execute as well. > the ones dropped > onto the main > form in the IDE I thought would be cleared up by some delphi magic. Yes that's correct. Components dropped onto a form or data module will be freed automatically when their owners, here TForm or TDatamodule are being destroyed. -- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html > Is this not > the case and I have to free them implicitly? > > Regards, > > Andy >> >> Sample: >> >> TForm1 = class(TForm) >> procedure FormCreate(Sender: TObject); >> procedure FormDestroy(Sender: TObject); >> .. >> public >> MyWSocket : TWSocket; >> end; >> >> implementation >> >> procedure TForm1.FormCreate(Sender: TObject); >> begin >> MyWSocket := TWSocket.Create(Self); >> end; >> >> procedure TForm1.FormDestroy(Sender: TObject); >> begin >> MyWSocket.Free; >> end; >> >> -- >> Arno Garrels [TeamICS] >> http://www.overbyte.be/eng/overbyte/teamics.html >> >>> When I exit my program, fastMM is creating a log. A snip of which >>> is: --------------------------------2007/3/23 15:40:59-------------- >>> ------ ------------ >>> A memory block has been leaked. The size is: 452 >>> >>> Stack trace of when this block was allocated (return addresses): >>> 403016 [EMAIL PROTECTED] >>> 404577 [system.pas][System][TObject.NewInstance][8824] >>> 40493E [EMAIL PROTECTED] >>> 4045AC [system.pas][System][TObject.Create][8839] >>> 48EB41 >>> [OverbyteIcsWndControl.pas][OverbyteIcsWndControl][TIcsWndHandlerPool.GetWndHandler][1017] >>> 48DD7F >>> [OverbyteIcsWndControl.pas][OverbyteIcsWndControl][TIcsWndControl.AllocateHWnd][419] >>> 4939E7 >>> [OverbyteIcsWSocket.pas][OverbyteIcsWSocket][TCustomWSocket.AllocateSocketHWnd][4231] >>> 493ACF >>> [OverbyteIcsWSocket.pas][OverbyteIcsWSocket][TCustomWSocket.Create][4268] >>> 499420 >>> [OverbyteIcsWSocket.pas][OverbyteIcsWSocket][TCustomSocksWSocket.Create][7253] >>> 49AFD8 >>> [OverbyteIcsWSocket.pas][OverbyteIcsWSocket][TCustomLineWSocket.Create][8083] >>> >>> The block is currently used for an object of class: TIcsWndHandler >>> >>> The allocation number is: 4898 >>> >>> Current memory dump of 256 bytes starting at pointer address >>> 131D780: 74 DB 48 00 FC 02 5A 00 70 55 32 01 70 55 32 01 70 55 32 >>> 01 70 55 32 01 70 55 32 >>> 01 70 55 32 01 >>> 70 55 32 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >>> 00 00 00 00 >>> 00 00 00 00 00 >>> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >>> 00 00 00 00 >>> 00 00 00 00 00 >>> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >>> 00 00 00 00 >>> 00 00 00 00 00 >>> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >>> 00 00 00 00 >>> 00 00 00 00 00 >>> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >>> 00 00 00 00 >>> 00 00 00 00 00 >>> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >>> 00 00 00 00 >>> 00 00 00 00 00 >>> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >>> 00 00 00 00 >>> 00 00 00 00 00 >>> t Û H . ü . Z . p U 2 . p U 2 . p U 2 . p U 2 >>> . p U 2 >>> . p U 2 . >>> p U 2 . . . . . . . . . . . . . . . . . . . . >>> . . . . >>> . . . . . >>> . . . . . . . . . . . . . . . . . . . . . . . >>> . . . . >>> . . . . . >>> . . . . . . . . . . . . . . . . . . . . . . . >>> . . . . >>> . . . . . >>> . . . . . . . . . . . . . . . . . . . . . . . >>> . . . . >>> . . . . . >>> . . . . . . . . . . . . . . . . . . . . . . . >>> . . . . >>> . . . . . >>> . . . . . . . . . . . . . . . . . . . . . . . >>> . . . . >>> . . . . . >>> . . . . . . . . . . . . . . . . . . . . . . . >>> . . . . >>> . . . . . >>> >>> >>> Now, is this 'normal' stuff, or really a leak? >>> >>> Any ideas? >>> >>> Thanks, >>> >>> Andy -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be