Delphi eating memory

I experienced in many cases that Delphi forgets to release memory in multiform applications. First i thouht some components do this. Now i made a really simple example to see if it was true, and it was.
I made a Form1 with a simple TButton with OnClick:

[code]
with tform2.Create(self) do
try
showmodal;
finally
free;
end;

[/code]


And there is my Form2 where i randomly dropped some Edit, Label, Speedbutton, Checkbox ... about 10 controls.

And now when i run the program it reserves
- 2099KB memory at startup
- 3012KB when i open up the Form2
- when i close Form2 it doesn't go back to 2099KB but remains on 3012KB
- opening again Form2 will go up to 3024KB
- and this value goes up to 4100KB when moving around the controls on Form2 (couldn't make it higher)
- now as writing on this forum i minimized the window to the taskbar and now reserves only 852KB
- restoring it it goes up to 1254KB
- then closing Form2 and opening several times it went up to 1604KB


Can somebody tell me how this all works? I'm concerned because i'll need to run some very complex interfaced applications on P2 machines with small RAM (like 32 or 64MB), and i mustn't let them run out of memory.


Comments

  • : Can somebody tell me how this all works?

    is Form2 by any chance also auto-created by your project? By default Delphi sets new forms to auto-create upon startup so check your project options.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion