- From: Florent Georges <fgeorges@fgeorges.org>
- Date: Wed, 18 Sep 2013 19:05:30 +0200
- To: XProc Dev <xproc-dev@w3.org>
Hi,
I use Calabash in Tomcat. Tomcat tells me that there is a memory
leak related to ThreadLocal variables never released (and with keys
and values from Calabash packages). I saw that the class
XProcExtensionFunctionDefinition uses a ThreadLocal variable. I added
log statements and was able to find that an object of the following
classes exists and its thread-local variable is set() once per thread:
com.xmlcalabash.functions.Cwd
com.xmlcalabash.functions.BaseURI
com.xmlcalabash.functions.ResolveURI
com.xmlcalabash.functions.SystemProperty
com.xmlcalabash.functions.StepAvailable
com.xmlcalabash.functions.IterationSize
com.xmlcalabash.functions.IterationPosition
com.xmlcalabash.functions.ValueAvailable
com.xmlcalabash.functions.VersionAvailable
com.xmlcalabash.functions.XPathVersionAvailable
So every time Tomcat receives a request served by Calabash, the
thread-local variable gets a new value. The problem is, they are
never released. Given that the value is the Calabash engine itself
(AKA XProcRuntime), it grows rapidely.
Because this is Calabash internals, I can't release them myself.
I am not sure how we can solve this one. Maybe by adding a method
to release (or close) the runtime object itself, that throws away
everything it does not need anymore, recursively, including releasing
the thread-local variables?
Or maybe simply by removing the thread-local variable? I am not
sure what it is used for.
Regards,
--
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/
Received on Wednesday, 18 September 2013 17:06:18 UTC