On 25 March 2010 20:49, cowwoc <[email protected]> wrote: > On 25/03/2010 12:13 PM, Bob Lee wrote: > > On Thu, Mar 25, 2010 at 8:55 AM, [email protected] <[email protected]>wrote: > >> On Mar 25, 6:30 am, cowwoc <[email protected]> wrote: >> > [...] I don't like the fact that you've chosen to ship the >> > product with a pretty sizable memory leak and no decent workaround. >> >> Umm... the decent workaround is to restart your application when you >> redeploy. > > This is not a viable solution for debugging web applications. Some > servers take over a minute to restart. In the past I had to issue a restart > every two runs because I'd run out of memory. This is a huge productivity > killer. > > +1 > > I'll fix it eventually. My fix will only work on specific VM's, of > course, as it'll depend on private APIs. > > So why not bite the bullet and add a shutdown method? There are plenty > of APIs with dispose() methods. Isn't this more reasonable than resorting to > complicated voodoo that only works for a subset of your users? Seeing as you > work for Google, why not ask Joshua Bloch for advice? >
Bob's actually moved to Square (https://squareup.com), but personally I also agree a shutdown method is cleaner. The downside of a shutdown method is that there's no easy way to stop people using the library after it's shutdown - of course this is hopefully an edge case, and just means soft/weak references wouldn't be collected until the app was finished. Another solution would be to add an OSGi bundle activator class: http://www.osgi.org/javadoc/r4v42/org/osgi/framework/BundleActivator.html to the internal package with a Bundle-Activator manifest entry pointing to it - it would mean Guice would need to build against the OSGi API jar, but clients would not need OSGi. The activator class would sit unnoticed in the internal package by most people as they'd never load it. But if Guice was installed onto an OSGi capable app-server like GlassFish then stopping the Guice bundle would notify the activator which could then shutdown the Finalizer thread without needing any special JVM knowledge or reflection tricks. This may be a good compromise to exposing a public shutdown method... Just my 2 sen. Gili > > -- > You received this message because you are subscribed to the Google Groups > "google-guice" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-guice%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-guice?hl=en. > -- Cheers, Stuart -- You received this message because you are subscribed to the Google Groups "google-guice" 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/google-guice?hl=en.
