HP Pascal/iX Programmer's Guide (31502-90023)

6- 11
ptr2 = ^real;
ptr3 = ^char;
ptr4 = ^ptr3;
VAR
m1 : ptr1;
m2 : ptr2;
m3 : ptr3;
m4 : ptr4;
m6 : ptr1;
r : RECORD
i : integer;
m5 : ptr1;
END;
BEGIN
mark(m1);
mark(m2);
mark(m3);
new(m4); {m4^ is of type ptr3}
mark(m4^);
mark(r.m5);
new(m6);
release(m6); {illegal -- current value of m6 was assigned by new}
END.
If you set several marks, and release one of them, those set after it are
also released.
Example 3
PROGRAM prog;
TYPE
ptr = ^integer;
VAR
m1, m2,
i1, i2, i3,
j1, j2, j3,
k1, k2, k3 : ptr;
BEGIN
new(i1);
new(i2);
new(i3);
mark(m1);
new(j1);
new(j2);
new(j3);
mark(m2);
new(k1);
new(k2);
new(k3);
release(m1); {deallocates j1,j2,j3,k1,k2,k3; releases m1 and m2}
release(m2); {illegal -- m2 is undefined because it was released
with m1}
END.
P_getheap and P_rtnheap Procedures
The procedures
p_getheap
and
p_rtnheap
are intrinsics in the Pascal
run-time library. Any program that runs on the operating system can call
them, regardless of the language in which it is written. (For more
information on intrinsics, Chapter 10 ).
The procedure
p_getheap
tries to allocate a region of heap space of a