cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Oliver <>
Subject Re: Continuations and memory leaks
Date Wed, 11 Feb 2004 15:40:18 GMT
Ugo Cei wrote:

> Christopher Oliver wrote:
>> Ugo Cei wrote:
>>> I'm experiencing a memory leak in an application we are currently 
>>> testing, which uses Flowscript and Woody. Since continuations store 
>>> a reference to local variables, and the memory leak does not 
>>> manifest itself if I don't create any continuation, I'm starting to 
>>> suspect that my usage of form.showForm is causing the leak.
>> What objects are leaked? Did you use Optimizeit or JProfiler to 
>> determine this? What does your script look like?
> All sorts of objects. My application uses Hibernate to persist objects 
> and retrieve them for editing in a Woody form. Those objects in turn 
> contain references to other persistent and/or transient objects or 
> collections of the same. Some of those references are really to 
> dynamic proxies, since Hibernate uses dynamic proxies for lazy loading.
> I am using Optimizeit and it shows lots of objects that are never 
> garbage-collected. The chains of references leading to these objects 
> are rather complex and make debugging the real case very difficult. I 
> will try to prepare a simpler testcase.
If this is indeed the case, how can I make sure that references to local 
variables will be properly nulled so that they can be garbage collected? 
Do they get forgotten when a continuation expires?

>> Yes.
>>> And what if I invalidate the continuation
>> Yes.
> Hmmm, from my tests, it looks like doing:
> var k = form.showForm(...);
> k.invalidate();
> does not make any difference. But I seem to recall that showForm() 
> creates not one but *two* continuations, so maybe I need to invalidate 
> also the one that is not returned by the function, but how?
 From looking at woody2.js showForm() seems to return the first 
continuation it creates, so the above should release all the 
continuations created during showForm().

> I also waited about 10 minutes to see if the expiration of 
> continuations  could allow the GC to reclaim some objects, but this 
> did not seem to be the case too.
Look at Optimizeit and see if there are any instances of 
org.mozilla.javascript.cotinuations.Continuation or 
org.apache.cocoon.components.flow.WebContinuation still around after this.


View raw message