incubator-flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Griswold <g...@shortsands.com>
Subject Memory Leak when using ViewNavigator.destructionPolicy='never'
Date Tue, 25 Dec 2012 02:20:26 GMT
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
Mime
View raw message