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. This happens implicitly when connecting to a capability exposed by the component. Connecting to a component that is already started reuses the 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.
{: width=“662”}
Note: For more details on component states and execution, see component lifecycle.