[gclist] Finalization and death notices
Sun, 7 Oct 2001 19:10:27 -0700
> From: Greg Colvin
> It wouldn't bother me if optaining locks in
> cleanup functions were also unsafe. Different restrictions might
> be appropriate in other languages, but the idea that the only thing
> a cleanup function should do is release resources seems appropriate
> to me.
The problem is that releasing resources often involves putting them back
into a global pool for reallocation. If the pool is maintained inside the
user program, that generally requires a lock. (If it's a kernel resource,
the issues doesn't arise, since the lock can't be acquired by user code.)
> The death notice idea has it's attractions as well, as it makes
> possible the promise that garbage collecting the memory of a
> correct C++ program will not break the program.
How so? You are still running arbitrary user code which wouldn't otherwise