The problem is elsewhere.
setResponsePage(Class) creates a new instance but this instance is
later reclaimed by the GC.
If you keep any reference to the created Page instance then it will
stay around until this reference is GC-ed.

You can use setResponsePage(Page) method to link to an existing instance.

On Thu, Aug 18, 2011 at 9:58 PM, eugenebalt <[email protected]> wrote:
> We have several Wicket pages that get constructed and then are available to
> the user via hyperlinks. There is no need to re-construct those Wicket pages
> because they never change from that point on. They are static "info pages."
>
> However, each time the user accesses a page, we construct a new instance,
> which decreases memory by 3 MB. We have a profiler running and we see that
> each time an existing page is accessed, free memory drops by a few MB.
>
> The link's action is to setResponsePage(MyPage.class), but that creates a
> new object. Suppose we were keeping all our Page objects in a Session. Is
> there a way to setResponsePage() to an existing Page instance?
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Cache-Wicket-Pages-rather-than-Construct-New-Objects-tp3753362p3753362.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to