home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
progpas
/
u-heap.arj
/
TEST.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-01-18
|
974b
|
63 lines
Program Test;
uses
CRT,UMB_Heap,ShowHeap;
const
BlockSize = 4096;
var
i,N : Word;
Mem1,Mem2 : LongInt;
X : Array[1..2000] of Pointer;
BEGIN
ClrScr;
WriteLn('THIS IS BEFORE...');
WriteLn;
Show_Heap;
Mem1 := MemAvail;
Extend_Heap;
Mem2 := MemAvail;
WriteLn;
WriteLn('THIS IS AFTER...');
WriteLn;
Show_Heap;
WriteLn(Mem2-Mem1,' bytes more memory!');
WriteLn;
WriteLn('PRESS ENTER TO TEST');
ReadLn;
WriteLn;
WriteLn('ALLOCATING ',BlockSize,' BYTE BLOCKS, VALUES INDICATE MEMAVAIL');
WriteLn;
N := 0;
Write(MemAvail:8);
while (MemAvail > 5*BlockSize) do
begin
Inc(N);
GetMem(X[N],BlockSize);
Write(MemAvail:8);
end;
WriteLn;
WriteLn;
WriteLn('PRESS ENTER TO DEALLOCATE');
ReadLn;
WriteLn;
for i := N downto 1 do
begin
FreeMem(X[i],BlockSize);
Write(MemAvail:8);
end;
WriteLn;
ReadLn;
END.