From: | ericmuttta@email.com (Eric) |
Newsgroups: | comp.compilers |
Date: | 20 Jun 2003 00:02:55 -0400 |
Organization: | http://groups.google.com/ |
References: | 03-05-211 03-06-015 03-06-054 03-06-057 |
Keywords: | design, storage |
Posted-Date: | 20 Jun 2003 00:02:55 EDT |
mwotton@cse.unsw.edu.au (Mark Alexander Wotton) wrote
> On 5 Jun 2003 23:22:01 -0400, Eric posted:
> >
> > I am having difficulty imagining a type which is implemented using
> > pointers and ensures that null cant occur. This would imply that for a
> > variable of such a type, memory would be allocated and then never
> > released.
>
> Either that, or only released when all references to it have passed
> out of scope. This is how many modern garbage-collected language
> implementations work.
This scheme (reference-counting) is used in VB6 for instance. VB7 (and
every other .NET language?) uses generational, mark-and-sweep GC (hope
that's the right term for it). When I read its description, it sounded
like a rather elaborate scheme and one that would need a good deal of
implementation effort. I prefer plain vanilla automatic
reference-counting. Its deterministic (hence useful in real-time
systems), simple to explain and understand, and a lot easier to
implement and get right.
I admit, reference-counting has its problems and I have been toying
around with an idea for what I call "compile-time reference-counting".
Basically, I am looking for a set of rules, that will allow the
compiler to figure out when to release memory for an object, *without*
having to allocate memory space for a reference counter value.
Instead, using these rules, the compiler can analyse code at compile
time and statically work out the life-time of an object. Its a bit
wishy washy at the moment but if its at all possible, I will write a
paper on it :)
> mrak
Cheers, E.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.