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

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



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.

Anything that's "externally-allocated" (i.e. file handles, database 
connections) needs to expose a contract that *requires* the programmer 
to explicitly 'release' the resource as soon as they can when they're 
finished with it (this has the advantage that managed code can run 
safely during resource release (e.g. your managed 
logging/instrumentation code)).

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.







-
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.