I have made two different posts the last couple of days about we going from XNA to MonoGame and how the application increase in memory and no input from keyboard is detected after the first time it has been launched. Using WinForms with a button to start a MonoGame.
private void button1_Click(object sender, EventArgs e)
{
viThread = new Thread(Demo);
viThread.Priority = ThreadPriority.Highest;
viThread.Start();
}
private void Demo()
{
using(Demo d = new Demo())
d.Run();
}
Since Monogame are using SharpDX (XNA did not) I call for a function when i Exit the application with Game.Exit() which look like:
SharpDX.Diagnostics.ObjectTracker.ReportActiveObjects().Length;
The number is always above 600. How can I Dispose/Remove all resources? I think that will solve both problems (memory leak for sure). Greetings
Both MonoGame and your code should dispose all objects and it will ultimately dispose SharpDX resources, but you should not having to dispose SharpDX resources directly. As MonoGame is a facade to SharpDX, it is usually considered as the owner of SharpDX objects. I don't know the details about MonoGame implementation, so I don't know if they are handling the whole Dispose process correctly but you should check this with them (A dispose of a Game class should call dispose on all GameComponent including the ContentManager... etc.)