1

i want write on console infor of memory include installed ram and usable ram: ex: installe memory: 4,00 GB(3,80 GB usable). currently, i did get "installe memory: 4,00 GB"

 public static void GetInstalledMemoryInfor()
    {
        ObjectQuery query = new ObjectQuery("SELECT Capacity FROM Win32_PhysicalMemory");
        ManagementObjectSearcher mos = new ManagementObjectSearcher(query);
        UInt64 capacity = 0;
        foreach (ManagementObject WmiObject in mos.Get())
        {
            capacity += (UInt64)WmiObject["Capacity"];
        }
        Console.WriteLine(String.Format("Installed memory (RAM): {0:N} GB", capacity / (1024 * 1024 * 1024)));
    }

how to get usable ram ? thanks 4 help me?

Luke Le
  • 728
  • 1
  • 9
  • 24
  • The entire physical memory is usable. It depends on who you're asking, to figure out the amount of *accessible* memory. If you're asking the physical memory, all you get as an answer is: "Hey, I'm here. Go ahead, use me!" – IInspectable Aug 06 '15 at 13:03

1 Answers1

0

Same question was asked and answered 3 days later.

TotalPhysicalMemory from VisualBasic.Devices slightly different from WMI Win32_PhysicalMemory

Summary: win32_ComputerSYstem.TotalPhysicalMemory is what you are after

Community
  • 1
  • 1
Patrick
  • 1,089
  • 14
  • 17