在C或C ++,你可以分配的内存(4GB&GT)一个非常大的单块? [英] Can you allocate a very large single chunk of memory ( > 4GB ) in c or c++?

查看:148
本文介绍了在C或C ++,你可以分配的内存(4GB&GT)一个非常大的单块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用非常大量的内存,这些天我在想,有可能分配一个单独的内存块是大于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的或新的上限。

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.

推荐答案

简短的回答:不太可能。

Short answer: Not likely

为了这个工作,你绝对会的包含以使用64位处理器。
其次,这将取决于操作系统支持单个进程超过4G的内存分配更多

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&GT)一个非常大的单块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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