I don't want to actually post all of my code. You may or may not have seen my new project that I have been working on. Well, I think it may have a small memory leak(if that is the correct term) of some kind. It's not a big number by my standards, but the point is that it does exist. I have been checking my code over and over and over. I have been looking at when anything is created at all in the code.
The memory leak is about 400bytes per 2 to 3 seconds while the game is running after it starts. The beginning memory usage via Task Manager shows 13k-ish then slowly rises after a few seconds to the rate I previous stated.
Is there anyway in Visual Studio 2010 Professional to debug to see everytime something is created? I am guessing it is a variable of some type. Pretty sure it's not an object as here is a basic overlook of object creation at this point:
SpriteManager Game Component creates 1 instance of objPlayer and objSword at the class level. That's it as far as any objects go. I have rechecked my update code in all three(clLink and clSword being the classes for the respectable objects) and nothing is creating any new variables during any type of updating that goes on during the game.
The only code I could think of that may be creating a new variable would be during the Draw portion:
#region Drawing Sprite On Screen
public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch)
{
spriteBatch.Draw(currentSprite, position, new Rectangle(currentFrame.X * frameSize.X, currentFrame.Y * frameSize.Y, frameSize.X, frameSize.Y), Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 0);
}
#endregion
..the new variable being new Rectangle part...
All sprites would/are dependent on a baseSprite abstract class which calls this during a Draw method call, so I am wondering that everytime I call the Draw on both objects of Player and Sword, it creates a new Rectangle variable.
Any thoughts? I am probably making a mistake(or a few) based upon inexperience but I am trying to improve through my current project.