Does monogame dispose everything itself ?

I want to use monogame instead sharpDX as it is more reliable. Now I just started a windows monogame project and did not see anything about disposing references. Is that all doing itself when app exit ?

MonoGame handles most resources. When the game exits, the Game instance is disposed (at least with the templates MG provides). Game in turn disposes any disposable attached GameComponents, its GraphicsDeviceManager, its ContentManager and it shuts down the audio backend. GraphicsDeviceManager.Dispose disposes the GraphicsDevice which dispose all graphical resources it is linked to. Disposing the ContentManager calls ContentManager.Unload and cleans up all disposable resources loaded by that ContentManager.

However, if you have resources that are not loaded during the complete lifetime of your game, you should dispose of them yourself.

1 Like