home *** CD-ROM | disk | FTP | other *** search
- { (C) Copyright 1986-1992 MetaWare Incorporated; Santa Cruz, CA 95060. }
-
- pragma C_include('Implement.pf');
- { Release(H) causes any item in the heap allocated since the
- call to Mark(H) to be freed.
- Typical usage:
- var H:HeapMark;
- ...
- Mark(H);
- new(...); new(...); new(...);
- ... -- perhaps more news ...
- Release(H);
- -- release all storage allocated since the mark.
- If the HeapMark H passed into Release is not valid,
- Release ignores the request.
-
- Release disposes memory in all heaps except heap #0.
- Release operates by examining each element in all heaps.
- Any such element allocated since the Mark was made is freed.
- Thus Release is not a "cheap" pointer copy as some may expect;
- however, it works on all systems we support.
-
- In the phrase "since the Mark was made" we refer to a notion of time.
- "Time" is maintained by a global counter. Each time a Mark is made,
- the counter is incremented and its value placed in the Mark structure.
- Upon Release, the global counter is set to the value stored, minus one;
- the global time is set back.
-
- }
- package Mark_release type HeapMark;
- pragma Routine_aliasing_convention(Implement.RTE_aliasing);
- type HeapMark = record
- Time_of_mark: Cardinal;
- Private: Cardinal; -- Used as a consistency check against trash.
- end;
- procedure Mark(var H: HeapMark); external;
- procedure Release(var H: HeapMark); external;
- -- VS Pascal mark/release for 8086 16-bit pointers.
- -- We store only the Time_of_mark and give up the Private protection.
- procedure VSMark(var C: Cardinal); external;
- procedure VSRelease(var C: Cardinal); external;
- end;
-