RE: Barracuda: Re:Barracuda Memory troubles
Vas Skrypnyk <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <8814509.1039419848290.JavaMail.root@babel> |
Hi Christian, >Hi Bill, > >So it sounds like you release your handle to the BTemplate, but the Model >still has a reference to it, which in turn would keep the BTemplate (and any >components it contains) from being >gc'd, since your model still has >references to them. Is that correct? That's correct. >It almost sounds like when a component calls the destroyCycle() method, it >needs a mechanism to disconnect any models which might >be listening to that >component. Thoughts? That sounds right. If destroyCycle() is called as the finalization code on the BTemplate object then, since it has references to all its models it should be able to disconnect itself. It will still be possible to hook in the same model to the same BTemplate and get the listener connection replicated, but, I suppose, the programmers should take some responsibility for their code :)) Cheers, --Bill. >Christian >---------------------------------------------- >Christian Cryder [[email protected]] >Internet Architect, ATMReports.com >Barracuda - http: >//barracuda.enhydra.org >---------------------------------------------- >"Coffee? I could quit anytime, just not today" > > >> -----Original Message----- >> From: [email protected] [mailto:barracuda- >[email protected]]On >> Behalf Of V B Skrypnyk >> Sent: Saturday, December 07, 2002 10:17 PM >> To: [email protected] >> Subject: Barracuda: Re:Barracuda Memory troubles >> >> >> Christian, >> >> >I have found where the memory leak was happening in my code. It >> is caused by the following scenario: >> >> 1. Create a BTemplate that will last for one servlet lifecycle >> (MainScreen). >> 2. Create >a Model that represents some persistent data and store >> it in the session (Tabs) >> 3. Have different portions of your application access >> session-saved Model and set up their data in it. (Tabs) > >> 4. On every MainScreen instantiation add the model, so that the >> respective portion of the template is rendered, i.e. Tabs. >> >> What happens now is that on every addModel() call a new listener > >> is added to the model and the list keeps growing until the model >> drags around megabytes of listeners, as happened in my case. >> >> Now, maybe instead of appending the listeners in the List it is > >> worthwhile checking if this listener has already been added, or >> maybe I am misusing the Barracuda framework. >> >> Please let me know what you think. >> >> Cheers, >> --Bill. >> _______________________________________________ > >> Barracuda mailing list >> [email protected] >> http://www.enhydra.org/mailman/listinfo.cgi/barracuda >> FAQ - http://www.jguru.com/faq/Barracuda > >_______________________________________________ > >Barracuda mailing list >[email protected] >http://www.enhydra.org/mailman/listinfo.cgi/barracuda >FAQ - http://www.jguru.com/faq/Barracuda > _______________________________________________ Barracuda mailing list [email protected] http://www.enhydra.org/mailman/listinfo.cgi/barracuda FAQ - http://www.jguru.com/faq/Barracuda