Comment #2 on issue 707 by mccu...@gmail.com: ThreadLocal leak
http://code.google.com/p/google-guice/issues/detail?id=707

This is the localContext ThreadLocal from InjectorImpl - this is actually an array of Objects, length 1, which holds the internal context while processing nested injection requests. The content of this array is nulled out when the outermost call completes, and it is only referenced from inside the injector, so technically there is nothing to stop the GC from collecting this chain. See http://blog.crazybob.org/2006/07/hard-core-java-threadlocal.html for the overall approach. However, due to a long-standing bug in the JDK's ThreadLocal design this entry may still appear in the thread's internal book-keeping map that Tomcat introspects. The entry should disappear after more ThreadLocals are created, as this then mutates the book-keeping map which clears the entry.

So if you are hot-deploying applications then this shouldn't cause a leak in practice, it's just the eager Tomcat detector warning about a potential leak based on it's internal introspection. There are ways we could force an immediate cleanup of the entry, but the downside is that this could then affect performance for everyone while fixing a theoretical issue.

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To post to this group, send email to google-guice-dev@googlegroups.com.
To unsubscribe from this group, send email to 
google-guice-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-guice-dev?hl=en.

Reply via email to