净为什么我不能得到超过分配的内存11GB的X64的进程? [英] .Net Why can't I get more than 11GB of allocated memory in a x64 process?

查看:187
本文介绍了净为什么我不能得到超过分配的内存11GB的X64的进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想,对于一个64位进程的最大用户空间为8TB,但我做了一个小测试,最大我可能得到的是10-11GB。

I thought that the maximum user space for a 64bit process was 8TB, but I did a little test and the maximum I could get is 10-11GB.

注:我不需要这么多内存的过程中,我只是想知道为什么出于好奇

Note: I don't need that much memory in a process, I just want to understand why out of curiosity.

下面是我的测试程序:

static void Main(string[] args)
{
    List<byte[]> list = new List<byte[]>();

    while (true)
    {
        Console.WriteLine("Press any key to allocate 1 more GB");
        Console.ReadKey(true);
        list.Add(new byte[1024 * 1024 * 1024]);

        Console.WriteLine("Memory size:");
        double memoryUsage = Process.GetCurrentProcess().PeakVirtualMemorySize64 / (double)(1024 * 1024 * 1024);
        Console.WriteLine(memoryUsage.ToString("0.00") + " GB");
        Console.WriteLine();
    }
}

编辑:

更新了测试程序更具有确定性。

Updated the test program to be more deterministic.

要接受一个答案,我想知道真正的最大分配的内存是如何计算的,如果8TB只是理论上的。

To accept an answer I would like to know how the real maximum allocated memory is calculated if 8TB is only theoretical.

推荐答案

这是 8 TB,而不是8 TB。你可能会拥有多达8 TB,但你需要匹配的RAM /交换文件。

It's up to 8 TB, not 8 TB. You can potentially have up to 8 TB, but you need the matching RAM/swapfile.

这篇关于净为什么我不能得到超过分配的内存11GB的X64的进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆