# A note on Singleton vs Transient

#### Note: A common misconception is that using Singleton Pages consumes vast amounts of memory, because after all, a fully realised `ContentPage` can have a large footprint. In `Maui`, cross-platform controls are lightweight wrappers around platform controls, and these controls are only instantiated when they are part of the visual tree.

We use Singleton for our `Pages` and `PageViewModels` where we can. The exceptions are:

`DetailPage`

* Two instances of `DetailPage` can exist, one on each navigation stack. `Maui` does not allow the same `Page` instance to be present in the visual tree in two places, so we register this `Page` as `Transient`, meaning a new one is created each time we *push* a `Page`

`DetailPageVm`

* Because we store a different message in our `ViewModel` depending on what pushed the `Page`, we need one `ViewModel` per `Page` instance, so we register the `DetailPageVm` as `Transient`

Try swapping `DetailPageVm` to `Singleton` and see if you can see why that's not right in this case.
