Navigator Memory Leak ?

While analysing the memory leak in our application, we come across the “currentView” variable in the Navigator class.
The variable seems to contain a reference of the last active view, even if the view is no longer displayed and attached to the UI.
In our case, the view was made of VerticalLayout with multiple sub layouts and child components. they all remained in the memory if the object was closed and taked out from the UI directly.

Since the variable is private, we are not able to reset the variable as well.

Any thoughts on that would be nice.

How did you end up in a situation that the currentView is no more the currently active view? Do you stop using Navigator (and views) at some point, but still use the actual UI?

Yes exactly. We have situations where user can switch to antoher Panel/Layout by clicking a link and we update our container with linked panel.

If you are stopping to use Navigator, maybe you could ui.getNavigator().destroy() ?

Then I guess you are out of luck with the available API. I’d suggest to add an enhancement issue to github with a good explanation of the requirement + possibly a pull request. If you are in a hurry you can probably use a customized Navigator class and use switchView method or raw reflection to set it to null, when you want to release the current view for GC.

cheers,
matti

Basically, we does not stop using navigator.
Imagine a left Menu area and right Content area. Choosing an option on left Menu area updates the right content area. here click listeners are implemented and they update the content on the right area.
Navigation is soley used on the right content area to navigate further deep down and come back.

There are situations where the right content area is emtpy. but the navigation still references the last navigated view via CurrentView variable.