home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / PROG / PASCAL / MISCTI10.ZIP / TI341.ASC < prev    next >
Encoding:
Text File  |  1988-04-18  |  675 b   |  26 lines

  1. PRODUCT : TURBO PASCAL     NUMBER : 341
  2. VERSION : 2.0xx
  3.      OS : 16-Bit
  4.    DATE : October 9, 1986
  5.  
  6.   TITLE : RELEASE PROCEDURE UPDATE
  7.  
  8. This  procedure is a work-around for a problem in version 2.0  of  
  9. Turbo  Pascal  that does not correctly release space on the  heap 
  10. when  a  pointer  is  allocated with  New  and  deallocated  with 
  11. Release.
  12.  
  13. The following routine should be called instead of Release to free 
  14. space on the heap. 
  15.  
  16. type
  17.   IntPtr = ^integer;
  18.  
  19. procedure ReleaseHeap(OldHeapPtr : IntPtr);
  20.  
  21. begin
  22.   FreeMem(OldHeapPtr, ((Seg(HeapPtr^) - Seg(OldHeapPtr^)) shl 4)
  23. +
  24.           (Ofs(HeapPtr^) - Ofs(OldHeapPtr^)));
  25. end; { ReleaseHeap }
  26.