Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the size of available system memory?

Is it possible to get the size of system available memory in C#.NET? if yes how?

like image 437
Louis Rhys Avatar asked Jul 21 '10 03:07

Louis Rhys


People also ask

How do I check available system memory?

Press Ctrl + Shift + Esc to launch Task Manager. Or, right-click the Taskbar and select Task Manager. Select the Performance tab and click Memory in the left panel. The Memory window lets you see your current RAM usage, check RAM speed, and view other memory hardware specifications.

What is available system memory?

Available memory is the amount of memory that is available for allocation to new or existing processes. Available memory is then an estimation of how much memory is available for use without swapping.

How do I find out the size of my Windows server memory?

Right-click on Start menu button and then click on Task Manager . Click on Performance tab and then on Memory option. The Memory option shows details such as Total memory, used memory and available memory. This option also shows two graphs related to the Memory in the server.


2 Answers

Use Microsoft.VisualBasic.Devices.ComputerInfo.TotalPhysicalMemory.

Right-click your project, Add Reference, select Microsoft.VisualBasic.

like image 152
Hans Passant Avatar answered Sep 25 '22 08:09

Hans Passant


This answer is based on Hans Passant's. The required property is AvailablePhysicalMemory actually. and it (and TotalPhysicalMemory and others) are instance variables, so it should be

new ComputerInfo().AvailablePhysicalMemory 

It works in C#, but I wonder why this page says that for C#, "This language is not supported or no code example is available."

like image 23
Louis Rhys Avatar answered Sep 24 '22 08:09

Louis Rhys