windows - Windows x64 的 44 位虚拟内存地址限制背后

标签 windows memory x86-64 memory-alignment virtual-address-space

http://www.alex-ionescu.com/?p=50

我读了上面的帖子。作者以单链表为例解释了为什么Windows x64仅支持44位虚拟内存地址。

struct {  // 8-byte header
        ULONGLONG Depth:16;
        ULONGLONG Sequence:9;
        ULONGLONG NextEntry:39;
} Header8;

The first sacrifice to make was to reduce the space for the sequence number to 9 bits instead of 16 bits, reducing the maximum sequence number the list could achieve. This still only left 39 bits for the pointer — a mediocre improvement over 32 bits. By forcing the structure to be 16-byte aligned when allocated, 4 more bits could be won, since the bottom bits could now always be assumed to be 0.


哦,我听不懂。

什么“通过在分配时强制结构进行 16 字节对齐,可以多赢得 4 位,因为现在可以始终假定底部位为 0。”方法?

最佳答案

16 is 0010000 in binary

32 is 0100000 in binary

64 is 1000000 in binary

等等

您可以看到,对于所有 16 的倍数的数字,最后四位始终为零。 因此,您可以将它们保留下来,并在需要使用指针时将它们添加回来,而不是存储这些位。

关于windows - Windows x64 的 44 位虚拟内存地址限制背后,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4563297/

相关文章:

c - 获取__data_start符号的地址

.net - WCF 可以托管在 Windows Nano Server 2016 上吗?

windows - Powershell脚本协助请

php - fatal error : Allowed memory size in PHP when allocating less

c++ - 如何在默认构造函数中将 char 数组初始化为 null?

c++ - 为什么在x86上除以3需要右移(以及其他奇数)?

assembly - 在不同 CPU 上表现不同的 X64 指令

windows - 在文件夹/子文件夹中的所有文件中搜索文本文件中的字符串的批处理文件

windows - 通过CMD下载网页内容

docker - 内存使用差异 : cgroup memory. usage_in_bytes 与 Docker 容器内的 RSS