XNA Creators Club Online
Page 1 of 1 (4 items)
Sort Posts: Previous Next

Memory Management

Last post 4/17/2009 7:49 PM by Adarther. 3 replies.
  • 4/17/2009 5:42 AM

    Memory Management

    Let me start by saying that I am very new to XNA, and to programming in general. I have an understanding of VB.NET and Java.

    My question is regarding memory management. I have been working through the first five tutorials on XNA, and have just completed number 3, sounds. I have noticed that my memory usage (looking at the process in Task Manager) steadily increases, even when the game is sitting idle. The same thing happens on the tutorial file supplied by Microsoft, although at a slightly slower rate.

    How do I prevent this from happening? What techniques must I use in my program to prevent it from steadily eating up all available memory?

    I understand if this question is too big to answer in this forum, so a link to a tutorial would be cool too, my Google searches did not turn up anything.

    Thanks,

    Luke

  • 4/17/2009 7:34 AM In reply to

    Re: Memory Management

    Don't let yourself be fooled by the indication of memory usage in the task manager. Every .NET i.e. managed application has a pretty high memory footprint. As far as I understand it, the framework will allocate much more memory than your application actually needs just in case it should really need it at some point. However, it will release the memory in case another application needs more memory. So as long as your application is running fine and doesn't start to lag, I wouldn't be concerned to much.

    Check out this article which explains it quite well: How much memory does my .NETapplication use?
    Be aware, the article was written back in the times of .NET 1. But I'd guess that even with 3.5 this situation does still exist.
  • 4/17/2009 3:27 PM In reply to

    Re: Memory Management

    For memory usage information, you should try CLR Profiler.  It is the "standard" free tool for tracing memory in .NET on Windows.  A quick search on Google will give you plenty of tutorials on how to use it.
    Microsoft DirectX/XNA MVP
  • 4/17/2009 7:49 PM In reply to

    Re: Memory Management

    Thanks for the advice guys, it's much appreciated.

    Luke

Page 1 of 1 (4 items) Previous Next