windows 虚拟分配粒度和页面大小

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/438863/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 11:48:58  来源:igfitidea点击:

Virtual allocation granularity and page size

cwindowswinapiwin64

提问by fbonnet

What are the typical values of the virtual allocation granularity and page size on Win64 platforms? That'd be SYSTEM_INFO's dwAllocationGranularity and dwPageSize.

Win64平台上虚拟分配粒度和页面大小的典型值是什么?那就是 SYSTEM_INFO 的 dwAllocationGranularity 和 dwPageSize。

On Win32 systems these would be 64k and 4k.

在 Win32 系统上,这些将是 64k 和 4k。

I need to know because I've designed a custom allocator based on VirtualAlloc for a Win32 application and wonder if my design choices are still valid on Win64. I have no access to a Win64 system.

我需要知道,因为我已经为 Win32 应用程序设计了一个基于 VirtualAlloc 的自定义分配器,并且想知道我的设计选择在 Win64 上是否仍然有效。我无法访问 Win64 系统。

Thanks in advance!

提前致谢!

回答by Hans Passant

It is still the same, 64k and 4k on Vista x64. Not so sure if that isn't going to change some day, the small page size is putting serious pressure on the TLB cache, degrading perf considerably for programs that allocate multi-gigabyte chunks. I've also seen several problem reports about not being able to allocate large pages anymore at some inscrutable point during program execution. But that's just crystal-ball staring for now.

Vista x64 上的 64k 和 4k 仍然相同。不太确定这是否会在某一天改变,小页面大小给 TLB 缓存带来了严重的压力,对于分配多 GB 块的程序来说,性能显着降低。我还看到了一些关于在程序执行过程中无法在某个难以理解的点再分配大页面的问题报告。但这只是目前的水晶球凝视。