On Sat, Dec 30, 2000 at 01:58:35AM -0500, Scott Gregory Miller wrote:
> > > >
> > > > The problem with GC is that it has a tendency to make programmers
> > > > forget that memory management is important. Even with GC, you still
> > > > have to worry about memory leaks and memory usage. With languages
> > > > such as C and C++, you *must* pay attention to these things, while GC
> > > > often allows programmers to forget about these things because GC
> > > > handles a lot of this stuff behind the scenes.
> > > No you don't. You're thinking about GC in languages that weren't designed
> > > for it.
> >
> > No, this animal really does exist in Java. Actually, it is a major
> > issue in Java. If it wasn't a major issue in Java, then at least one
> > major article in an issue of Doctor Dobb's Journal was a complete
> > lie. A prominent example of this is you pass an object to another
> > object as a listener. If you forget to remove the former object from
> > the latter object, the former object will never be GCed as long as the
> > latter object exists.
> I think you misread the article. No such bug/issue exists in Java. The
> listener example holds, but has nothing to do with private/protected.
> That is an example of giving a reference to a datastructure and forgetting
> you've done so. Its not a memory leak. A memory leak is when all
> references to an allocated block of memory are lost and no mechanism
> exists to reclaim it.
In this case not all of the references to an object have been lost,
but there is no way to reclaim the object because the object that it
has been passed to will not automatically remove it (it has no way of
telling that you are done with the object that has been passed to it),
and if the rest of the program has lost all references to the object
then the object is effectively a leak.
--
Travis Bemann
Sendmail is still screwed up on my box.
My email address is really [EMAIL PROTECTED]
PGP signature