Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7596297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:53:07+00:00 2026-05-30T21:53:07+00:00

I have a question about degrading performance in XNA. I am using the GameStateManagement

  • 0

I have a question about degrading performance in XNA. I am using the GameStateManagement example from Microsoft to create my game. I currently have a main menu screen (GameScreen), a splash screen (Game Screen), high score screen (GameScreen), game play screen (GameScreen), and an options menu (MenuScreen). I have had my game running in the pre-production environment for around 48 hours. After switching between the main menu screen, splash screen, and highscore screen every five seconds for 36 or so hours the game performance really takes a hit and becomes unresponsive and the framerate drops to around 3fps.

Is there anyway to track this issue down in the GameStateManagement example. I have not made any changes to the base classes, I have just made child classes to add to the ScreenManager.

When I switch to a new screen I do this:

Main Menu to Splash Screen:

      foreach (GameScreen screen in ScreenManager.GetScreens())
        screen.ExitScreen();
      ScreenManager.AddScreen(new SplashBackgroundScreen(), null);
      ScreenManager.AddScreen(new SplashScreen(), null);

Splash Screen to Highscore Screen

      foreach (GameScreen screen in ScreenManager.GetScreens())
        screen.ExitScreen();
      ScreenManager.AddScreen(new BackgroundScreen(), null);
      ScreenManager.AddScreen(new HighScoreScreen(), null);

Highscore Screen back to Main Menu Screen

      foreach (GameScreen screen in ScreenManager.GetScreens())
        screen.ExitScreen();
      ScreenManager.AddScreen(new BackgroundScreen(), null);
      ScreenManager.AddScreen(new MainMenuScreen(), null);

I am running Windows 7 Home Premium x64 with 4GB of RAM on an Intel i3-2100 with Intel HD2000 graphics.

Are there any tools available to check for memory leaks in XNA. Are there any good tactics to start tracking down an issue like this? Would manually calling a garbage collection in the constructor of each game screen help?

EDIT

To clarify the above: In practice, what are the most efficient tools to find memory leaks relating to XNA?

The ScreenManager class keeps track of a stack of screens for the game, when you call ExitScreen it removes it from the stack.

ExitScreen() in GameScreen parent class:

    public void ExitScreen()
    {
        if (TransitionOffTime == TimeSpan.Zero)
        {
            ScreenManager.RemoveScreen(this);
        }
        else
        {
            isExiting = true;
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T21:53:09+00:00Added an answer on May 30, 2026 at 9:53 pm

    I don’t program XNA, but it looks like your causing a memory leak.

    ScreenManager.GetScreens() seams to return an enumerable of GameScreen. Does screen.ExitScreen() remove the GameScreen reference from ScreenManager’s underlying collection of GameScreens?

    Seems to me like your adding new instances

    ScreenManager.AddScreen(new ..., null);
    

    But never removing Exited / old / unused instances.

    Perhaps you could add all your “GameScreen” instances to ScreenManager once at the beginning of your program and then hide/show just the “GameScreen”‘s you want on State Change events.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question about this formula from a book: EFW (cm,kg)= 10^(-1,7492+(0,166*BPD)+(0,046*AC)-(2,646*AC*BPD/1000)) The
I have question about sending emails from MVC3 application. I already read for exmple
Have a question about stored procedure: How to retrieve the variable's value from stored
I have question about 301 Redirect please: example: http://stackapp.com/post/35642 to: http://google.com/posts/index.php?q=http://stackapp.com/post/35642 Note: I want
I have question regarding about finding subview using '.tags' in one UIView. for (UIView
I'm learning asp.net. I have question about example buttons I can use two types
I have question about python and sqlite3. I want to drop a table from
I have question about removing element from QList. myclass.h: class node2D : public QObject
Have a question about sending data between classes and activities. I currently have a
I have question about managing transaction in asp.net application. For example i have application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.