3
{ Program to demonstrate the TCollection.Free method }
5
Uses Objects,MyObject; { For TMyObject definition and registration }
13
C:=New(PCollection,Init(120,10));
15
Writeln ('Initial memory : ',InitMem);
18
M:=New(PMyObject,Init);
22
Writeln ('Added 100 Items. Memory available : ',Memavail);
23
Write ('Lost : ',Initmem-Memavail,' bytes.');
24
Write ('(Should be 100*',SizeOF(TMyObject));
25
Writeln ('=',100*SizeOf(TMyObject),')');
27
While Count>0 do Free(At(Count-1));
28
Writeln ('Freed all objects. Memory available : ',Memavail);
29
Writeln ('Lost : ',Initmem-Memavail,' bytes.');
b'\\ No newline at end of file'