Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2011.08.14;
Скачать: CL | DM;

Вниз

"memory hoarding" problem   Найти похожие ветки 

 
jarek   (2009-03-03 17:50) [0]

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


 
Дмитрий К ©   (2009-03-03 20:35) [1]

in NewForm1
Form := NewForm( ...
Form.Add2AutoFree(Result);


 
Jon ©   (2009-03-03 22:01) [2]

Also make use of
SetProcessWorkingSetSize(GetCurrentProcess,Cardinal(-1),Cardinal(-1));
at convenient places, such as after freeing form.



Страницы: 1 вся ветка

Текущий архив: 2011.08.14;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.012 c
2-1304349822
_CuBiC_
2011-05-02 19:23
2011.08.14
Как открыть выделенный файл


6-1240487526
ZERAM
2009-04-23 15:52
2011.08.14
idHHP и charset


15-1303830643
Kerk
2011-04-26 19:10
2011.08.14
IT-профессионал - это кто?


15-1302979210
KilkennyCat
2011-04-16 22:40
2011.08.14
Начинающим разработчикам систем с ARM-процессорами


15-1303631334
IPranker
2011-04-24 11:48
2011.08.14
Что такое CRC?