HEAP_COMPACT [ HP Pascal/iX Reference Manual ] MPE/iX 5.0 Documentation
HP Pascal/iX Reference Manual
HEAP_COMPACT
HEAP_COMPACT is an HP Pascal Option.
When the HEAP_COMPACT compiler option is ON (and the HEAP_DISPOSE option
is also ON), free space in the heap is concatenated when the predefined
procedure dispose is called.
Syntax
$HEAP_COMPACT {ON }$
{OFF}
Default OFF.
Location At front.
The HEAP_COMPACT option is recommended for programs that manipulate many
dynamic record variables of different sizes via calls to the predefined
procedures new and dispose. It allows free space to be merged and
reused.
Example
$HEAP_COMPACT ON; HEAP_DISPOSE ON$
PROGRAM show_compact;
TYPE
big_rec = RECORD
f1 : ARRAY [1..4] OF integer;
END;
small_rec = PACKED RECORD
f1 : integer;
f2 : integer;
END;
VAR
p1,p2 : ^mall_rec;
p3 : ^big_rec;
BEGIN
new(p1);
new(p2);
dispose(p1);
dispose(p2);
new(p3); {p3 is allocated in the space previously
occupied by p1 and p2}
END.
MPE/iX 5.0 Documentation