You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Anthony E. Carlos" <an...@digitalphenom.com> on 2004/09/27 07:39:03 UTC

memory leak or bad technique?

Hello,

I'm trying to pin down a memory problem and I think it might be the 
static field introspector of 
org.apache.velocity.util.introspection.UberspectImpl.

I'm not an expert, so I'll explain my methodology.

I have a working web app that I'm running in Tomcat. I load a page and 
get a result and, using JProfiler, I take a snapshot of the heap and 
take a look at the class list. Then, I reload the web app using 
Tomcat's manager. After loading the same page and getting the same 
result, I take another snapshot of the heap and see multiple instances 
of some of the classes in question.


class #1: org.apache.struts.action.ActionServlet
After the first snapshot, only 1 instance with GC root of 
org.apache.catalina.startup.Boostrap#daemon.

After the second snapshot, 2 instances. One as above, and another with 
GC root of org.apache.velocity.runtime.RuntimeSingleton.

class #2: org.apache.velocity.tools.view.servlet.ServletLogger
After the first snapshot, only 1 instance with GC root of 
org.apache.velocity.runtime.RuntimeSingleton#ri.

After the second snapshot, 2 instances. One as above, and another with 
GC root of 
org.apache.velocity.util.introspection.UberspectImpl#introspector.

class #3: org.apache.velocity.runtime.RuntimeInstance
After the first snapshot, only 1 instance with GC root of 
org.apache.velocity.runtime.RuntimeSingleton#ri.

After the second snapshot, 2 instances. One as above, and another with 
GC root of 
org.apache.velocity.util.introspection.UberspectImpl#introspector


So, if I'm reading this correctly, it looks like the static field of 
UberspectImpl is hanging onto a reference of RuntimeSingleton which is 
holding onto a whole bunch of other stuff. I found it curious that 
RuntimeInstance pointed to UberspectImpl and vice versa.

I looked in the docs for some kind of destroy() method, but couldn't 
find anything. Is there a method that I need to call during the 
destruction of a context to release all resources? Or, is there a 
memory leak?

Thanks for your help,

-Anthony Carlos


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org