Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Memory Leak? (https://www.delphipraxis.net/97873-memory-leak.html)

Razor 17. Aug 2007 18:20


Memory Leak?
 
Liste der Anhänge anzeigen (Anzahl: 1)
Hello!

Yes i get error when closing my application,I included the screenshot.But this error and message only show when i use FastMM(Memory Manager replacement). :wall:


Can you give me an advice on making my application faster,it takes about 3-4 secs to start?

DGL-luke 17. Aug 2007 18:26

Re: Memory Leak?
 
oh yeah, fastmm tells you that you have A WHOLE BUNCH of mermory leaks. You have to free all object instances you use after use.

As they mainly seem to be VCL components, maybe you are dynamically instatiating them? then you should still free them after use!

Razor 17. Aug 2007 18:29

Re: Memory Leak?
 
So you mean like this?

Delphi-Quellcode:
procedure tmainfrm.cpuid;
begin
 MiTeC_CPU1.RefreshData;
 RzPanel10.caption:=MiTeC_CPU1.SerialNumber;
 if mitec_cpu1.CPUIDSupported=true then
 RzPanel11.Caption:='Yes'
 else
 RzPanel11.Caption:='No';
end;
MiTeC_CPU1.free;
 RzPanel10.caption.free;

end;

Phoenix 17. Aug 2007 19:16

Re: Memory Leak?
 
Actually the how is correct. But the where or better: when is wrong.

Every control you create dynamically, you need to free in the destructor of the owner. That is - in that case - the destructor of the Form.


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:48 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz