[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ProgSoc] Deterministic destruction of objects in garbage-collected languages



On Tue, 2007-07-17 at 01:44 +1000, John Elliot wrote:

> On Tue, 17 Jul 2007, Roland Turner wrote:
> > So, where does this leave "but I need to clean up
> > externally-allocated resources quickly?" (file handles, database
> > connections, ...).
> 
> I think the important thing in talking about this issue is to highlight 
> the distinction between "internally-allocated resources" 
> and "externally-allocated resources".
> 
> Anything that's "internally-allocated" (i.e. virtual memory) is managed 
> by the GC and the programmer doesn't need to worry about it.

Right. This is akin to the note that circulated years ago justifying the
exposure to programmers of the different semantics for RMI vs. local
calls. Concealing the non-fate-sharing nature of non-fate-sharing
relationships is harmful.

> The problems around this issue in my view are related to conflation 
> of "internal" and "external" (relative to the VM) resources. They're 
> two different things, and they shouldn't be treated as if they are the 
> same thing.

But programmers with abstraction-mania will do this :-)

> That is, when the GC is freeing an object's virtual memory, it could 
> check (during a debug build, or contingent on some configuration)
> that 
> the "requires external release" contract had been honoured. That is, 
> that the programmer using an API that required them to explicitly 
> release an externally allocated resource had kept their part of the 
> deal.

Interesting idea.

- Raz


-
You are subscribed to the progsoc mailing list. To unsubscribe, send a
message containing "unsubscribe" to progsoc-request@xxxxxxxxxxxxxxxxxxx
If you are having trouble, ask owner-progsoc@xxxxxxxxxxxxxxxxxx for help.