views:

4215

answers:

4

How can I get the available ram or memory used by the application?

A: 

You should take a look at the System.Diagnostics.Process class.

Ronald Wildenberg
+2  A: 

System.Environment has WorkingSet. If you want a lot of details there is System.Diagnostics.PerformanceCounter, but it will be a bit more effort to setup.

Austin
+6  A: 

You can use:

Process proc = Process.GetCurrentProcess();

To get the current process and use:

proc.PrivateMemorySize64;

To get the private memory usage. For more information look at this link.

Arkain
+2  A: 

You might want to check the GC.GetTotalMemory method.

It retrieves the number of bytes currently thought to be allocated by the garbage collector.

CMS