Jump to content
Xtreme .Net Talk

How to get memory information (free/total/vm/etc...) of a pc [C#]


Recommended Posts

Posted

When the Out_Of_Memory exception is caught I want to log the systems current memory usage (not application, system), minimally free memory... Preferably also max memory, free VM and max VM, and anything else that can pin point the system state when it crashes...

Now I know how to do this in WMI or Script but I have not been able to find a way to accomplish this task in C# (2005/2.0)...

Any ideas, hints, and help would be greatly appreciated, thanks

Posted
The idea is - the exception is "Out Of Memory" so I want to see the memory at 0 - so I thought if I outputed the actual memory usage I would see it be 0... I just find it odd that my program, while loading the map, can max out a 128meg ram machine running XP SP2.... odd indeed...
  • Leaders
Posted
Maybe you should upload some code. It sounds like you have some severe memory management issues. Perhaps you are doing lots of string processing and the garbage collector is not getting a chance to clean up all the old strings (this can, on a very large scale operation, eat a huge amount of memory), or you aren't disposing large objects, or something to that effect. If you upload all of the code in question we could analyze it and possibly identify some issues.
[sIGPIC]e[/sIGPIC]
Posted

marble_eater: I have attached a full set of CLR Profiler logs to another post on a similar topic (http://www.xtremedotnettalk.com/showthread.php?p=458499#post458499), hopefully that can help in the analysis...

 

As for code, I am working on posting some snipplets with explanation on areas where I think I may possibly be leaking memory, etc ... - I'll follow up shortly (I need to write it out first).

 

Thanks for the help - much appreciated...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...