[英]How to use as much RAM as possible for my program?
I am striving to maximize speed of my program (in order to get results in real-time) and avoid unnecessary loading of data from hard drive. 我正在努力最大化我的程序速度(以便实时获得结果)并避免从硬盘驱动器中不必要地加载数据。
Program is supposed to process a huge amount of images and I would like to handle in RAM as much processed data as possible. 程序应该处理大量的图像,我想尽可能多地处理RAM中的处理数据。 But I found out that malloc
won't allocate more than 2GB even when I'm having 8GB of RAM (Windows 7 64-bit). 但我发现即使我有8GB的RAM(Windows 7 64位), malloc
也不会分配超过2GB的内存。
How can I make my program use as much RAM as possible? 如何让我的程序尽可能多地使用RAM?
I believe the windows equivalent of mmap(2)
is VirtualAlloc
我认为相当于mmap(2)
的窗口是VirtualAlloc
This should allow you to use a lot more memory. 这应该允许您使用更多的内存。 Please keep in mind that the OS may still decide to page out your memory. 请记住,操作系统仍可能决定将您的记忆分页。 You can lock it in RAM with VirtualLock
. 您可以使用VirtualLock
将其锁定在RAM中。 The amount of lockable memory may be limited though. 然而,可锁定存储器的数量可能是有限的。
Also as mentioned in the comments make sure to compile your program as 64-bit. 另外,如评论中所述,请确保将程序编译为64位。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.