You can use the PerformanceCounter class from the System.Diagnostics namespace to get the amount of free memory on the system. Here is an example:
main.cs315 chars12 linesTo get the total amount of physical memory on the system, you can use the ManagementObjectSearcher class from the System.Management namespace:
main.cs467 chars13 linesNote that the TotalPhysicalMemory property is only available on some versions of Windows. If it is not available, result will be null and totalMemory will be 0.
gistlibby LogSnag