Le 28 sept. 04, à 02:02, Hans Gilde a écrit :

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.

I'd rather find the converse natural:
- the script should be rebuilt if need be
- but if the script (or some snippets) is re-run, I'd like it to re-run with its original beans...


My little reload-tag does the following and I think it's quite appropriate. Basically, it considers each component-tag as a browser frame.

<swing:panel>
 <!-- some content -->
 <swing:button><swing:action name="Do">
        <swing:reload level="2"/>
   </swing:action></swing:button>
</swing:panel>

When the Do button is pressed, my reload tag empties the content of the panel and re-runs the body-script which re-populates the panel depending on an XML-document which got updated by this GUI.
(I am using Xwing, a typical example is to have a forEach inside the panel that iterates on children, the reload is wished when you add something and where the forEach should be re-run).


I know there are ways out differently (instead of the reload, actually execute a tag or function which does the population) it's just, much more elegant, I feel!

paul

PS: there's a taste of browser-DOM-connection out there... maybe it's good, or not...


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



Reply via email to