When a user starts an app (in the SAP Fiori launchpad (FLP) or using an HTML page), several steps will be performed in the background.
When a user closes the app, the destroy function of the component is called. All models and the router are destroyed. The router will take care of destroying the views.
If a controller has created resources that need to be destroyed explicitly, for example non-aggregated controls, the app developer has to use the onExit function of the controller to free up resources. For more information, see Controller.