This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Question About Unremoved ThreadLocations
- From: Taylor Venable <venablet at ipfw dot edu>
- To: kawa at sourceware dot org
- Date: Fri, 16 Dec 2011 14:30:39 -0500
- Subject: Question About Unremoved ThreadLocations
Hi there, I've been writing a servlet using Kawa, and it's been quite
awesome. But I've been getting some messages from Tomcat about memory
leaks due to unremoved ThreadLocals (here's an example):
Dec 15, 2011 3:55:04 PM org.apache.catalina.loader.WebappClassLoader
checkThreadLocalMapForLeaks
SEVERE: The web application [/sis-conversion] created a ThreadLocal with
key of type [gnu.mapping.ThreadLocation.InheritingLocation] (value
[gnu.mapping.ThreadLocation$InheritingLocation@71c94ff3]) and a value of
type [gnu.mapping.SharedLocation] (value
[gnu.mapping.SharedLocation[line-length/(dynamic)]]) but failed to
remove it when the web application was stopped. Threads are going to be
renewed over time to try and avoid a probable memory leak.
This seems to be related to using fluids, since they're implemented
using ThreadLocation objects (if my understanding is correct). I'm
assuming that for my case in particular this is probably not a big
problem because Tomcat can renew the threads and effectively do away
with the wasted memory. Now for my admittedly vague and probably
ignorant question: Is there anything I can do to "fix" the leaks from
within my servlet?
I've put an example at https://gist.github.com/1487521 for more clarity.
Thanks for corrections, additional information, and advice.
--
Taylor ChriÅtopher Venable
Senior Programmer/Analyst
IPFW IT Services KT 204K / 209A
2101 E. Coliseum Blvd.
Fort Wayne, IN 46805
260-481-0720