问题描述
这些天我想知道有非常大量的内存,是否可以分配大于 4GB 的单个内存块?或者我是否需要分配一堆较小的块并处理它们之间的切换?
With very large amounts of ram these days I was wondering, it is possible to allocate a single chunk of memory that is larger than 4GB? Or would I need to allocate a bunch of smaller chunks and handle switching between them?
为什么???我正在处理一些 openstreetmap xml 数据,这些文件很大.我目前正在流式传输它们,因为我无法将它们全部加载到一个块中,但我只是对 malloc 或 new 的上限感到好奇.
Why??? I'm working on processing some openstreetmap xml data and these files are huge. I'm currently streaming them in since I can't load them all in one chunk but I just got curious about the upper limits on malloc or new.
推荐答案
简短回答:不太可能
为了使其工作,您绝对必须使用 64 位处理器.其次,这将取决于操作系统支持为单个进程分配超过 4G 的 RAM.
In order for this to work, you absolutely would have to use a 64-bit processor. Secondly, it would depend on the Operating System support for allocating more than 4G of RAM to a single process.
理论上,这是可能的,但您必须阅读内存分配器的文档.您也更容易受到内存碎片问题的影响.
In theory, it would be possible, but you would have to read the documentation for the memory allocator. You would also be more susceptible to memory fragmentation issues.
有关于 Windows 内存管理的好信息.
这篇关于你能在 c 或 c++ 中分配一个非常大的单个内存块(> 4GB)吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)