~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to docs/objectex/ex30.pp

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Program ex30;
2
 
 
3
 
{ Program to demonstrate the TCollection.Free method }
4
 
 
5
 
Uses Objects,MyObject; { For TMyObject definition and registration }
6
 
 
7
 
Var C : PCollection;
8
 
    M : PMyObject;
9
 
    I,InitMem : Longint;
10
 
 
11
 
begin
12
 
  Randomize;
13
 
  C:=New(PCollection,Init(120,10));
14
 
  InitMem:=Memavail;
15
 
  Writeln ('Initial memory : ',InitMem);
16
 
  For I:=1 to 100 do
17
 
    begin
18
 
    M:=New(PMyObject,Init);
19
 
    M^.SetField(I-1);
20
 
    C^.Insert(M);
21
 
    end;
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),')');
26
 
  With C^ do
27
 
    While Count>0 do Free(At(Count-1)); 
28
 
  Writeln ('Freed all objects. Memory available : ',Memavail);
29
 
  Writeln ('Lost : ',Initmem-Memavail,' bytes.');
30
 
  Dispose(C,Done);
31
 
end.
 
 
b'\\ No newline at end of file'