Skip to main content
added 2 characters in body
Source Link
Omar
  • 16.6k
  • 10
  • 51
  • 68

You can try GC.GetTotalMemory:

It Retrieves the number of bytes currently thought to be allocated. A parameter indicates whether this method can wait a short interval > before returning, to allow the system to collect garbage and finalize > objects.

It Retrieves the number of bytes currently thought to be allocated. A parameter indicates whether this method can wait a short interval > before returning, to allow the system to collect garbage and finalize > objects.


or

using System.Diagnostics;

Process currentProc = Process.GetCurrentProcess();

Once you have a reference to the current process, you can determine its memory usage by reading the PrivateMemorySize64 property.

long memoryUsed = currentProc.PrivateMemorySize64;

You can try GC.GetTotalMemory:

It Retrieves the number of bytes currently thought to be allocated. A parameter indicates whether this method can wait a short interval > before returning, to allow the system to collect garbage and finalize > objects.

or

using System.Diagnostics;

Process currentProc = Process.GetCurrentProcess();

Once you have a reference to the current process, you can determine its memory usage by reading the PrivateMemorySize64 property.

long memoryUsed = currentProc.PrivateMemorySize64;

You can try GC.GetTotalMemory:

It Retrieves the number of bytes currently thought to be allocated. A parameter indicates whether this method can wait a short interval > before returning, to allow the system to collect garbage and finalize > objects.


or

using System.Diagnostics;

Process currentProc = Process.GetCurrentProcess();

Once you have a reference to the current process, you can determine its memory usage by reading the PrivateMemorySize64 property.

long memoryUsed = currentProc.PrivateMemorySize64;
Source Link
Rahul Ranjan
  • 1.1k
  • 1
  • 12
  • 28

You can try GC.GetTotalMemory:

It Retrieves the number of bytes currently thought to be allocated. A parameter indicates whether this method can wait a short interval > before returning, to allow the system to collect garbage and finalize > objects.

or

using System.Diagnostics;

Process currentProc = Process.GetCurrentProcess();

Once you have a reference to the current process, you can determine its memory usage by reading the PrivateMemorySize64 property.

long memoryUsed = currentProc.PrivateMemorySize64;