Category : Pascal Source Code
Archive   : PASS_ALL.ZIP
Filename : TI341.ASC

 
Output of file : TI341.ASC contained in archive : PASS_ALL.ZIP









PRODUCT : TURBO PASCAL NUMBER : 341
VERSION : 2.0xx
OS : 16-Bit
DATE : October 9, 1986 PAGE : 1/1
TITLE : RELEASE PROCEDURE UPDATET




This procedure is a work-around for a problem in version 2.0 of
Turbo Pascal that does not correctly release space on the heap
when a pointer is allocated with New and deallocated with
Release.

The following routine should be called instead of Release to free
space on the heap.

type
IntPtr = ^integer;

procedure ReleaseHeap(OldHeapPtr : IntPtr);

begin
FreeMem(OldHeapPtr, ((Seg(HeapPtr^) - Seg(OldHeapPtr^)) shl 4) +
(Ofs(HeapPtr^) - Ofs(OldHeapPtr^)));
end; { ReleaseHeap }