You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Gary Griswold <ga...@shortsands.com> on 2012/12/25 03:20:26 UTC
Memory Leak when using ViewNavigator.destructionPolicy='never'
Hello,
I have a question about ViewNavigator destructionPolicy='never'. I am getting a very nice performance improvement by using it, but using it and popAll() and popToFirst() introduces a memory leak, and it doesn't seem like the API provides the functions needed to prevent the leak.
One way to view the problem is that there is no way to access or reuse a view with destructionPolicy='never' once it has been popped. It is cached somewhere, holding onto all its members, but inaccessible. So, when doing a popView() one can change the destructionPolicy to 'auto' so that the view will be destroyed at that time.
This works well, it means that we can pop back to a view without recreating it, and then destroy it when it is popped off the stack. But when we need to do a popAll() or popToFirst() there doesn't seem to be a way to access the views that are being popped. So, all of those popped views and their members become a memory leak.
Possible solutions are as follows:
1) Add an optional parameter to popAll(..) and popToFirst(..) that will change the destructionPolicy of the views to 'auto' before the pop.
2) Add a method to ViewNavigator that would allow one to access the NavigatorStack.
3) Add a new destructionPolicy that will destroy a view that is popped, but not destroy it when a new view is pushed on top of it.
I really think a solution to this problem would be an important benefit to the performance of Mobile Flex.
Merry Christmas everyone,
Gary Griswold