Re: Memory management vs. Resource management
Posted: Sep 6, 2005 2:34 PM
> See Anjan Bacchu's post:
> There is one case where the use of explicit nulling is
> not only helpful, but virtually required, and that is
> where a reference to an object is scoped more broadly than
> it is used or considered valid by the program's
Yes, that's a design bug, not a problem with GC-based (or manual) memory management.
> Nulling is not neccessary is the strict sense of the term,
> but failure to do so is probably a violation of the design
So you seem to be arguing for this additional complication (nulling references) instead of actually fixing the design? That makes no sense.
> > (B) Your arguments also seem to be conflating memory
> > management and the more general issue of resource
> > management.
> But memory is a resource.
It's a special resource because of how it's treated throughout the chain (hardware, OS, libraries, languages, etc). Seriously, this is a major issue in terms of perennial attempts to piggyback and all of the complexity and failures that have resulted.
> > (C) Resource management is, IMNSHO, absolutely critical in
> > software and general purpose programming languages are
> > generally wretched at it. I totally concur that this is a
> > big deal that e.g., needs to be addressed in new/updated
> > languages. I don't see how your shifting of where things
> > are dealt with in Heron is anything new / significantly
> > better. Perhaps you can clarify?
> Heron doesn't do this any differently than C++. You can
> use an object to represent a resource, and free the
> resource once the object is destroyed. I don't see any
> particular problems with this approach, but that is
> probably because I am unaware of any better way to do it.
> I am open to suggestions, as to how this can be improved,
> though I would be curious what the problems are with the
> RAII approach used commonly in C++.
Are you also piggybacking general resource on top of the memory management system or just relying on the usual C++ approach?
I thought one of the goals with Here was performance? Completely manual memory management is more error prone and slower, in general, than good GC.
I thought one of the points of spending the time to actually create a new general purpose programming language was to actually make the world a better place. If you're sticking with the same old (dysfunctional) memory and resource management model, how are things going to improve?
In terms of the problems with that approach isn't the voluminous literature enough? Managing all of the issues around identity, ownership, access, scope, and extent are all ridiculously complicated. To be clear, I'm not just picking on Heron or C/C++ but the vast majority of general purpose programming languages including Java, Lisp, etc.