On Thursday 23 July 2009 09:49:20 am Roger Pack wrote: > > That is, on 1.9.1, the object is never collected. > > The kicker here is it may not be a bug--it may be that there is a "ghost > reference" to the object still kicking around somewhere [on the stack or > what not]. Right -- which I would consider to be a bug. Or, at the very least, it's very inconvenient, and not at all what's expected. > In general, however, you're not guaranteed that finalizers will be > called at any point--only guaranteed that they'll be called before the > program exits (I think that's what happens anyway). I understand, which is why I'm not bothered that for some reason, the first object wasn't collected until the second one was created. I don't mind if the GC is sloppy. I do mind when it's an actual leak -- in this case, the objects in question are pretty heavyweight, and if I create a few thousand threads that way, I'll have a few thousand of them stuck forever.