Skip navigation
Currently Being Moderated

Flex mobile ViewNavigatorApplication, destructionPolicy, and best practice for memory management

Dec 29, 2011 6:31 AM

Tags: #flex #ios #viewnavigatorapplication #destructionpolicy

From what I understand, the default behavior is that a view is destroyed when a user navigates away from it.  This is good.  There must be more to the story however.


I have an app that has three or four views.  One of the views is complex and contains a video player.  I notice when I leave this view using the "back" selection in the IOS iPad emulator, the video keeps playing.  It, and its rtmp connection, are not destroyed.


What is the best practice here?  What things are destroyed and what things are not?  Should I be listening for viewDeactivate and manually destroying any of the view's subcomponents and variables?

  • Currently Being Moderated
    Feb 22, 2012 4:09 PM   in reply to rexdtripod

    I was just dealing with this today on my app, which also has a view with a video object, netstream, netconnection, etc.  I was seeing a lot of memory leakage on my device, which then caused the app to crash on the device due to it running out of memory.


    here's what I suggest:

    -Clean up, close and null all netconnection objects when leaving the view.  You should also null all video objects as well.  Anything additional that you might have instantiated in actionscript instead of the view mxml.

    -The View will take care of discarding its components, any subviews that are present. 


    If you have FlashBuilder Premium you can use the Flex Profiler to see memory usage of your app when running in the simulator.  If you're still seeing problems you can use that tool to diagnose your memory usage

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points