home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 December
/
simtel1292_SIMTEL_1292_Walnut_Creek.iso
/
msdos
/
progjorn
/
pj_6_3.arc
/
HEAP4
< prev
next >
Wrap
Text File
|
1988-04-05
|
1KB
|
58 lines
Borland International's HEAP4. Copyright 1988 Borland
International. No commercial use of this code without express
permission from Borland International.
Run this one under TP4:
program Heap4; {$R-}
{ Compile and run under both Turbo Pascal 3.0 and 4.0.
Runs faster under 4.0.
}
const
ArraySize = 1000;
type
Byte3 = array[1..3] of Byte;
Byte5 = array[1..5] of Byte;
Byte7 = array[1..7] of Byte;
Byte9 = array[1..9] of Byte;
Ptr3 = ^Byte3;
Ptr5 = ^Byte5;
Ptr7 = ^Byte7;
Ptr9 = ^Byte9;
var
P5: array[1..ArraySize] of Ptr5;
P7: array[1..ArraySize] of Ptr7;
Q3: array[1..ArraySize] of Ptr3;
Q9: array[1..ArraySize] of Ptr9;
I: Integer;
Timer: Integer absolute $40:$6C;
Start: Integer;
begin
WriteLn('Start');
Start := Timer;
for I := 1 to ArraySize do { allocation loop }
begin
New(P5[I]);
New(P7[I]);
end;
for I := ArraySize downto 1 do { fragmentation loop }
begin
Dispose(P5[I]);
New(Q3[I]);
New(Q9[I]);
Dispose(P7[I]);
end;
Writeln('Done in ',(Timer-Start)/18.2:0:1,' seconds.');
end.