动态分配限制 [英] dynamic allocation limitation

查看:70
本文介绍了动态分配限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



您好,



我对动态内存分配有疑问。



是否有可以分配的内存量的限制(硬件可用内存除外)?



我可以在一个循环中分配1MB 2000次,导致2GB的内存分配?



我有一个微弱的内存,表示每个应用程序有2GB的内存分配限制



我能超过这个限制吗?怎么样?



谢谢!



dj4400

解决方案

分配限制由两个因素定义:所使用的处理器的指令集架构(应该由适当的Windows版本支持)和可用的物理内存。最重要的是,分配受当前内存利用率的限制。是的,有2GB的限制,但仅适用于32位版本。如您所见,32位平面地址空间将可寻址字节数限制为4Gb,但根据Windows文档,操作系统仅为应用程序保留2Gb或3Gb(可调参数)。



显然,这种基于4Gb的限制不适用于64位指令集架构,因此,在实践中,目前可寻址空间受物理RAM和操作系统的限制。



如需了解更多详情,请参阅: http://msdn.microsoft.com/en-us/library/windows/desktop/aa366778%28v=vs.85%29.aspx [ ^ ]。< br $> b $ b

参见: http://en.wikipedia.org/wiki/ Instruction_set [ ^ ]。







我刚注意到你没有将您的操作系统标记为Windows或其他任何内容。我只是假设它是关于Windows的,因为你提到了熟悉的2Gb屏障。



请参阅我对该问题的评论;始终标记您的平台。对于其他操作系统,请参阅相应的文档。



我也忘了提到,在CPU的指令集架构旁边,内存显然受限于主板的设计。在某些情况下(特别是在过去的型号中),即使插槽的数量足以满足某些最大内存量,并非所有内存模块组合都能满负荷工作或甚至无法识别。在购买内存之前,请务必查阅主板文档。



-SA


更改标志在项目属性中。

转到属性 - »链接器 - »系统和设置

启用大地址支持

地址大于2Gb


Hi,

I have a question about dynamic memory allocation.

Is there a limitation (except hardware - available RAM) on the amount of memory that can be allocated?

can i allocate 1MB in a loop 2000 times resulting in a 2GB of memory allocation?

I have a faint memory that says that there is a 2GB limit of memory allocation per application

can i over ride this limit? how?

Thanks!

dj4400

解决方案

The allocation limit is defined by two factors: instruction-set architecture of the processor used (should be supported by the adequate Windows version), and available physical memory. On top of it, the allocation is limited by the current level of memory utilization. Yes, there is a 2GB limit, but only for 32-bit versions. As you can see, 32-bit flat address space limit the number of addressable bytes by 4Gb, but, according to Windows documentation, only 2Gb or 3Gb (tunable) is reserved by OS for applications.

Apparently, this 4Gb-based limitations are not applicable to 64-bit instruction-set architectures, so, in practice, these days, addressable space is limited by the physically available RAM and OS.

For further detail, please see: http://msdn.microsoft.com/en-us/library/windows/desktop/aa366778%28v=vs.85%29.aspx[^].

See also: http://en.wikipedia.org/wiki/Instruction_set[^].

[EDIT]

I just noticed that you did not tag your OS as Windows or anything else. I just assumed it was about Windows, because you mentioned the familiar 2Gb barrier.

Please see my comment to the question; always tag your platform. For other OS, please see appropriate documentation.

I also forgot to mention that, next to the instruction-set architecture of the CPU, the memory is apparently limited by the design of the motherboard. In some cases (especially in the past models), even if the number of slots was enough for some maximum amount of memory, not all combinations of memory modules works at full capacity or even recognized. Before you buy memory, always consult the motherboard documentation.

—SA


Changing a flag in the project properties.
Go To Properties-»linker-»system and Set
The Enable Large addresses To Support
addresses Larger Than 2Gb


这篇关于动态分配限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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