I guess I just don't like relying on samples :-) AFAIK the specification does not only fail to specify when the finalizer is called, it doesn't even guarantee that it will. I guess if you deploy your desktop application with an embedded JRE it is ok to rely on it, but in general it seems risky to assume something works just because so far it worked on every JRE you looked at.
But then -- I might be wrong, a lot of my knowledge comes more from hearsay than actual facts ;-) Peter kirk wrote: > Hi Ben, > > On every VM I've worked with finalize support is implemented pretty much > the same way. That would be all Sun based VMs and IBM's implementation. > It's been a while with JRocket but I think they are close. There is *no* > benefit for the JVM to keep object hanging about for any longer than > necessary. VM implementors are working very hard to make sure that > objects are cleared ASAP. > > Regards, > Kirk > > Ben Schulz wrote: > >> On 22 Jul., 13:51, kirk <[email protected]> wrote: >> >> >>>> If only finalize() would be reliable. >>>> >>>> >>> finalize is reliable, you just have to understand how it's implemented. >>> >>> >> I'm pretty sure that a JVM may never reclaim any memory, obviously not >> a very viable strategy, but it does imply that finalize() is not >> reliable. Are you perhaps assuming the program is run on a Hotspot >> JVM? >> >> With kind regards >> Ben >> >> >> > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaposse?hl=en -~----------~----~----~----~------~----~------~--~---
