Thanks for the quick answer! After doing some exhaustive testing, I've just found out that, just before seeing your answer. The problem was that it wasn't until the 20th instance that finally the garbage collector decided to free up some memmory (I tried calling it explicitly but apparently the memmory wasn't too occupied so it did nothing). On Thu, Sep 24, 2009 at 12:14 AM, Igor Vaynberg <[email protected]>wrote:
> the instances are held in memory until the jvm runs the garbage collector. > > -igor > > On Wed, Sep 23, 2009 at 8:09 PM, Esteban Ignacio Masoero > <[email protected]> wrote: > > Hi: > > I'm not sure whether this behavior is normal or not, so I'm going to > > describe it and I hope someone can tell me if I'm doing something wrong > or > > if there's just nothing wrong! > > > > In my app I found out that each time a request is made, old instances of > a > > page remain in memory, and get accumulated in time (I noticed this > behavior > > by looking at the "All instances" feature from eclipse debug's > perspective). > > I searched the code for bad practices like anonyomus Model classes, but I > > didn't find those kind of thins. So finally I created a new simple > project > > to test whether this behaviour repeated there too, and I found out that > it > > did! > > > > Here's the new simple project code (wicket 1.3.5, tomcat 6, eclipse > > galileo): > > > > public class MyApp extends WebApplication { > > @Override > > public Class getHomePage() { > > return MyPage.class; > > } > > } > > > > public class MyPage extends WebPage { > > private String text; > > public MyPage() { > > this("<notext>"); > > } > > public MyPage(String textt) { > > super(); > > this.text = textt; > > Form form = new Form("form"){ > > private static final long serialVersionUID = -3566834353426372805L; > > @Override > > protected void onSubmit() { > > setResponsePage(new MyPage2(text)); > > } > > }; > > form.add(new TextField("text", new PropertyModel(this, "text"))); > > form.add(new Button("accept")); > > this.add(form); > > } > > } > > > > <Class MyPage2 does the exact same thing, except it sets MyPage as the > > response page.> > > > > When debugging (with a breakpoint in MyPage's constructor), every time a > new > > page is instanciated, I see that the old instances of that page remains > in > > memory. Using the "All references" feature I "walked" through the > > reference-path, and I reached a weakReference to this page from a > > "SerializedPagesCache$SerializedPageWithSession" instance (I had to stop > > there because it was driving me crazy). (Of course I have no idea whether > > this is normal or not, I'm just giving more info) > > > > Anyway, can anyone tell me what's wrong? Or is this a expected behavior > and > > sometime later this old instances will be eliminated from the jvm? > > > > Thanks in advance, > > > > Esteban > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
