I have a strange problem with XNA 4. I'm constructing a SpriteBatch using this.spriteBatch = new SpriteBatch( GraphicsDevice );.
This leads to a memory leak up to 600 MB memory consumption.
This problem didn't exist two days ago.
I have a static class called Resources:
public static GraphicsDeviceManager gdm;
This gets set in the Game-constructor
public class Game : Microsoft.Xna.Framework.Game {
public Game() {
Resources.gdm = new GraphicsDeviceManager( this );
Content.RootDirectory = "Content";
}
}
In the Initialize-Method I'm creating a SpriteBatch in the Resources
protected override void Initialize() {
base.Initialize();
Resources.Game = this;
Resources.spriteBatch = new SpriteBatch( GraphicsDevice );
}
At the point Resources.spriteBatch = new SpriteBatch( GraphicsDevice ); it allocates up to 600 MB memory.
Why is XNA allocating so much after I created a SpriteBatch? How can I fix it? (It worked two days ago and I didn't change anything that could cause this problem.)