startTime: BasicTime.GMT = BasicTime.Now[];
WHILE BasicTime.Period[startTime, BasicTime.Now[]] < 30
DO
noAllocs: CARDINAL = Random.ChooseInt[min: 1, max: 5];
noScan: CARDINAL = Random.ChooseInt[min: noAllocs, max: noAllocs*3];
FOR free:
CARDINAL
IN [1..noScan]
DO
IF bufferArray[freeRover].size # 0
THEN {
RPCLupine.DeAlloc[bufferArray[freeRover].address, bufferArray[freeRover].size];
bufferArray[freeRover].size ← 0;
};
freeRover ← freeRover + 1;
IF freeRover > 128 THEN freeRover ← 1;
ENDLOOP;
FOR alloc:
CARDINAL
IN [1..noAllocs]
DO
size: CARDINAL = Random.ChooseInt[min: 1, max: 8] * 256;
address: LONG POINTER TO WORD ;
probe: CARDINAL;
address ← RPCLupine.Alloc[size];
probe ← Random.ChooseInt[min: 1, max: 128];
DO
IF bufferArray[probe].size = 0
THEN {
bufferArray[probe].size ← size;
bufferArray[probe].address ← address;
EXIT;
};
probe ← probe + 1;
IF probe > 128 THEN probe ← 1;
ENDLOOP;
ENDLOOP;
ENDLOOP;