[gclist] Destructor functions and GC
Dave Lloyd
dave@occl-cam.demon.co.uk
Tue, 5 Mar 96 18:23:25 BST
Some of the revent posts on GC and OO have reminded me of a problem that
occurred to me some years ago: how does a GC interact with destructor
functions? Algol 68 doesn't provide these, but I have often felt a twinge of
need for them (and then promptly done the same manually). A good example from
recent events is the use of system-supplied semaphores which must be returned
(closed) when finished with. However with the normal free scheme, you know
exactly when these functions will get called, what is in scope, the state of
any external IO, etc - and most uses I think of for destructor functions are
definitely NOT context-free.
With the sort of heap I run, it is not even easy to spot objects that are no
longer accessible (I only see words that are inaccessible). I doubt this need
be a problem if the original allocation blocks are tagged someway. But the
question is, what do you do about the context in which destructor functions are
called?
----------------------------------------------------------------------
Dave Lloyd Email: Dave@occl-cam.demon.co.uk
Oxford and Cambridge Compilers Ltd Phone: (44) 1223 572074
55 Brampton Rd, Cambridge CB1 3HJ, UK