|
-
August 8th, 2006, 07:31 PM
#1
How to measure memory usage? [C#]
Some of you might recall I had issues running my application (game) on a slower machine (WinXP SP2, .Net 2.0, 1.6gig cpu, 256 megs ram [I know this is really really low, but still most high-end games work fine]), each time it was launched it generated a "Out of Memory" Exception ("System.OutOfMemoryException: Out of memory.")
So to resolve the problem I did some "optimization" and was able to make a big difference - it crashes much later on in the Level Generation phase (where I create all my cells, objects, characters, etc... - this is the chunk that counts)...
Obviously this wasn't good enough but I spent an entire night looking through my code and was unable to find really anything I thought would make a huge difference (mind you - I am far from an expert on the subject)...
So the next step is to find out WHERE in my GenerateLevel() function all the memory is being eaten up - so I was wondering if there was a nice & easy way to get the Memory Usage of my program at different point in the GenerateLevel() function (that I would trace out to a text file) - this should enable me to "see" where in the code the most amount of memory is eaten and hopefully allow my to try and minimize it as much as possible...
Unless someone has some other suggestions? Profiling tools? Better methods of solving my problem, etc...?
Any ideas, hints, and help would be greatly appreciated, thanks
-
August 9th, 2006, 06:34 AM
#2
Re: How to measure memory usage? [C#]
Check out the CLR Profiler, allows you to analyse your assemblies in great detail.
CLR Profiler 1.1
You can view time lines, full call stack....how much memory each object you create consumes etc etc.
Only thing thats annoying about this is that it's an 'intrusive' process, it'll slow down code execution 10-100 times.
If it helped, then please rate the post by clicking "Rate this post"!
-
August 9th, 2006, 11:01 AM
#3
Re: How to measure memory usage? [C#]
Also ANTS Profiler works fine (http://www.red-gate.co.uk/products/a...iler/index.htm) and I personally was very satisfied with profiler by Borland called Optimizeit, but it seems that the .NET version is no longer supported.
- Make it run.
- Make it right.
- Make it fast.
Don't hesitate to rate my post. 
-
August 9th, 2006, 08:10 PM
#4
Re: How to measure memory usage? [C#]
Dmorley -> I am using CLR Profilier 2.0 (C# 2005) - problem is I am having a hard time making heads or tails out of the results... Do you know CLR Profiler well? Given the traces would you be able to help pinpoint the source of the problem?
Or any other help/recommendations would be greatly appreciated.
Thanks,
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|