![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
"memory hoarding" problem [Delphi, Windows]
jarek © (2009-03-03 17:50:00)Hi all,
I have problem with this code:
program FormsTest;
uses
KOL;
type
PForm1 = ^TForm1;
TForm1 = object(TObj)
Form: PControl;
public
procedure FrmClick(Sender: PObj);
end;
var
Form1: PForm1;
procedure NewForm1(var Result: PForm1; AParent: PControl);
begin
New(Result,Create);
with Result^ do
begin
Form := NewForm(AParent,'Form1').SetSize(320,240);
Form.OnFormClick := FrmClick;
end;
end;
procedure TForm1.FrmClick(Sender: PObj);
var
NewForm: PForm1;
begin
NewForm1(NewForm,Applet);
NewForm.Form.Show;
NewForm.Free;
end;
begin
Applet := NewApplet('Forms Test');
NewForm1(Form1,Applet);
Run(Applet);
end.
Application takes after start 3108 kB of memory.
When I click on the form, new window opens and application takes more of memory. If I close this new window, the usage of RAM not changes.
If I open 100 new windows, application takes 3376 kB of RAM. If I close all new windows, application still takes 3376 kB of RAM.
Can anybody help me?
Thanks. jarek
Jon (2009-03-03 22:01:00) [1]Also make use of
SetProcessWorkingSetSize(GetCurrentProcess,Cardinal(-1),Cardinal(-1));
at convenient places, such as after freeing form.
Дмитрий К (2009-03-03 20:35:00) [2]in NewForm1
Form := NewForm( ...
Form.Add2AutoFree(Result);