[comp.lang.pascal] Turbo Dispose

filbo@gorn.santa-cruz.ca.us (Bela Lubkin) (08/05/89)

In article <1087@tukki.jyu.fi> tarvaine@tukki.jyu.fi (Tapani Tarvainen) writes:
>In article <3.filbo@gorn.santa-cruz.ca.us> filbo@gorn.santa-cruz.ca.us (Bela Lubkin) writes:
>>  (I don't think there's an exception routine for
>>Dispose -- how could it fail?)
>Yes it can, rare though it is:  There is a fixed size reserved
>for the free space list, and if you free a block that isn't adjacent
>to another, you need room for another entry.  If memory becomes
>sufficiently fragmented, it is possible to fill the list.
>This is described on p. 197-198 in TP 5.0 Reference Guide;
>it says there is room for 8191 noncontiguous freed blocks.
>BTW, it isn't quite as unlikely as the manual suggests:
>it happened to me once!
Right.  My manuals still haven't been moved over (or if they have, they're
buried at the bottom of one box or another): am I correct in remembering
that there's no exception procedure for Dispose() failures?

I should have remembered this failure more for Dispose.  My former
housemate's multiuser BBS, written in Turbo (5.5, now), crashes once in a
while due to heap fragmentation -- too many free blocks.  One of these
days he's going to put in a heap compactor.

(XBBS -- not related to the XENIX BBS of the same abbreviation -- runs 4
1200 dialups, 2 4800 hardwires, and the console, on an original IBM 8MHz
AT; it used to run sans the hardwires on a Victor 9000.  It is a discussion
board, no file storage, at USA: (408) 476-4945).  

>Tapani Tarvainen    (tarvaine@jyu.fi, tarvainen@finjyu.bitnet)

Bela Lubkin     * *   filbo@gorn.santa-cruz.ca.us   CIS: 73047,1112
     @        * *     ...ucbvax!ucscc!gorn!filbo    ^^^  REALLY slow [months]
R Pentomino     *     Filbo @ Pyrzqxgl (408) 476-4633 & XBBS (408) 476-4945

tarvaine@tukki.jyu.fi (Tapani Tarvainen) (08/07/89)

In article <5.filbo@gorn.santa-cruz.ca.us> filbo@gorn.santa-cruz.ca.us (Bela Lubkin) writes:
..
>  My manuals still haven't been moved over (or if they have, they're
>buried at the bottom of one box or another): am I correct in remembering
>that there's no exception procedure for Dispose() failures?

Yes, at least as far as I know and can find in the 5.0 manual: 

"The heap error function gets called whenever a call to New or Getmem
cannot complete the request."  

"Trying to dispose of a pointer when the free list is full causes a
runtime error."

Too bad.  I'm afraid the only reliable way out is writing your own
memory allocation routines.
-- 
Tapani Tarvainen    (tarvaine@jyu.fi, tarvainen@finjyu.bitnet)