Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. But I found out that malloc won't allocate more than 2GB even when I'm having 8GB of RAM (Windows 7 64-bit).

How can I make my program use as much RAM as possible?

like image 490
enn Avatar asked Aug 09 '13 11:08

enn


1 Answers

I believe the windows equivalent of mmap(2) is 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. The amount of lockable memory may be limited though.

Also as mentioned in the comments make sure to compile your program as 64-bit.

like image 98
Sergey L. Avatar answered Sep 22 '22 16:09

Sergey L.