Component instances are created and destroyed when they are added and removed in the component topology. This can happen in one of two ways:
collection
at runtime using the fuchsia.component.Realm
protocol. Dynamic components are destroyed on system shutdown.Once a component is destroyed, the framework removes its persistent state (such as local storage).
The framework starts a component instance when another component attempts to open a channel to it — known as binding. Binding happens implicitly when connecting to a capability exposed by the component. Binding to a component that is already started connects to the currently running instance.
Components may stop themselves by exiting the program (as defined by the component's runner
), or the framework may stop the component as part of system shutdown. Before being destroyed, the framework moves components to a shutdown state to indicate that it cannot be started again.
{: width=“662”}
Note: For more details on component states and execution, see component lifecycle.