Various people commented on HP's getheap and rtnheap intrinsics.
However, no one commented on an undocumented feature of the
native-mode p_getheap and p_rtnheap.
Warning! Warning! Warning! Warning! Warning! Warning! Warning!
If you do NOT have a Pascal/iX outer-block for your program, p_rtnheap
will *not* return all data to the heap. You must call an undocumented
Pascal/iX run-time routine in order to enable any sort of heap reuse.
It took us about six or seven years of native-mode heap use before we
discovered this problem. In our programs, we now always invoke a
routine that calls p'init'heap and p'set'compaction:
procedure p'init'heap;
option native, nocc, uppercase, external;
! Note P_SET_COMPACTION is "extensible", so we pass the
! number of parameters as the first parm in R26.
procedure p'set'compaction(no'parms,compact'value);
value no'parms, compact'value;
double no'parms, compact'value;
option native, nocc, uppercase, external;
p'init'heap;
p'set'compaction(1,1);
Note: I believe that you *never* want to call these two routines
more than once, although I don't know what will happen if you
do (I was told to "only call once"). I also think that you
must call these routines before calling p_getheap or p_rtnheap.
I don't know all possible values for "compact'value", but I suspect
that they are related to the Pascl/iX compiler options for dealing
with heap compaction. The value "1" seems to work fine for us.
Cheers,
David <[log in to unmask]>
p.s. I've been away the last four days and I'm only now catching up
on my HP3000-L digests. If someone else pointed this out on
Fri, Sat, Sun, or Mon, sorry. /djg
|