Home TotalVirtualMemory returns unrealistic number for my application
Reply: 0

TotalVirtualMemory returns unrealistic number for my application

user913
1#
user913 Published in April 22, 2018, 12:53 am

My application is returning a very large number for TotalVirtualMemory. I instantiate a ComputerInfo() object and call TotalVirtualMemory and the value returned is ~130TB. Creating a basic project to test this seems to return the correct value: ~4GB. What could be causing this? My Code is below:

using System;  
using Microsoft.VisualBasic.Devices;

namespace ConsoleApp1
{
    public class Program
    {
        private static void Main(string[] args)
        {
            var test = new Program();
            Console.WriteLine($"Total Virtual Memory: {test.GetTotalVirtualMemory()}");
            Console.WriteLine($"Total Virtual Memory Readable: {test.GetTotalVirtualMemory() * (1.0 / 1024.0 / 1024.0 / 1024.0)}");
        }

        public ulong GetTotalVirtualMemory()
        {
            return new ComputerInfo().TotalVirtualMemory;
        }
    }
}
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.308716 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO