Here's the memory "leak" that was fixed by nulling out the component. It's
not so much of a leak as a "holding on to references that should be
available to the GC":

I might want to build several instances of a JFrame from the same Jelly
script. But, I may not. I may simply keep that Script around but never end
up using it again. 

Let's say that my frame uses lots of memory. I build a frame using my
script. Now that script has a reference to my frame. I dispose of the frame,
but I don't end up creating another one.

I expected that my frame would be available for GC, but it wasn't because
it's still referenced by the script that I'm keeping around just in case.



If you want access to a component created by another tag, why not use the
"var" attribute:

<button name="foo" var="bar"/>

This button will now be available to subsequent tags like this:

<action class="my.special.Action" component="${bar}"/>

In the action, the component itself (JButton) has been set in using
putValue() and is available using getValue().

Is this documented? Not really. Should it be? Yes.

One of these days, I'll get around to the Jelly Wikki, which will include
this topic.

-----Original Message-----
From: Paul Libbrecht [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 27, 2004 2:40 PM
To: Jakarta Commons Developers List
Subject: [jelly] should caching be configurable ?

Hi,

I sent recently a request so as to know wether consider jelly 
components as browser windows would make sense or not and had no real 
answer. So I'll give it a subject of the other side: in the current 
tree, the component-tag does clear its bean after having run the 
doTag...

And to me this is a problem: I'd like to make a reload tag which would 
take a numeric argument, the ancestry degree, default 1. When run (in 
doTag), it should call the doTag of the given ancestor component.

I see no single memory-leak issue in jelly-swing currently: it's 
perfectly reasonable for me that tags do hold a reference to their 
bean.

Is it crazy to have an explicit method to clean-up the references? 
Something that would be triggered either explicitly (somewhat like 
"unmount()", good for use by servlets) or at GC time when, say, the 
script object gets GCed ?

paul


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to