Unallocate view from memory

Hi,

I was wondering if there was any way to avoid to stock the view in Memory. I’ll explain:

When you navigate in the application, you use a view with components filled with some values (imagine a form the user have filled). Then you go away from the view replacing it by another one. But if you want to display the view again, you retrieve all the informations you had filled previously. Of course I could add a treatment to clear all components when my view is called but they are still allocate in memory. I would like to find a way to litteraly remove the instance of my view from the session and create a new one each time the view is called.
I’ve seen a way of doing this by setting them to null and let the garbage collector do his job but I was wondering if a more elegant solution was existing.

Hi,

If understood your question correctly, you have pretty much nothing to worry about. The client side widgets are usually being killed on detach of the component (e.g. when you replace it with smth else). The reason why you get the same data when you go back is that the server side state is maintained (which is not that bad and heavy imho). When the component is being reattached - the client side version is recreated on the basis of the server state. If you want to get rid of the server state - kill all the references to it and GC will do its job. If your aim is to have clear components on back navigation - then you will have to take care of the values yourself.

kind regards,
sasha.

Hi,

Thanks for your answer, I was thinking of the server side. I have indeed cleared all the references to my components when they aren’t used to recreate them when the view is called again. I was looking for an easiest way to do that but it doesn’t seem to exist so I’ll keep doing it this way!

I have already reduced my session size

regards

Valentine

Hi,

If you encounter the issues with the allocated memory, maybe you should try to tune the GC. For instance, I recall that setting the garbage collector to the incremental state helps in some cases ( -Xincgc as far as i remember).

kind regards,
sasha