• Advertisement
Sign in to follow this  

Memory Limits in C++ Program

This topic is 2306 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

I have a C++ program that I am running on Windows 7 (compiled using MinGW, being ported from a 64-bit Linux platform). It requires a vast amount of memory, but malloc() is returning NULL even though several gigs of RAM are unused. I noticed that it is capping the amount of memory my program can have to the 32-bit limit (and opening Task Manager shows that Windows is running the process as a 32-bit application with a "* 32" next to it).

Does anyone know how I would fix this, and allow Windows to run my program in a 64-bit mode that allows it to fully utilize all the RAM?

Thanks beforehand :).

Share this post


Link to post
Share on other sites
Advertisement
You need to build it as a 64 bit application. [s]What compiler are you using?
In Visual Studio select the configuration manager and add a 64-bit target for your application. Of course you need the necessary 64 bit compilers installed.[/s]

Share this post


Link to post
Share on other sites
Either use MingW-w64 to build a native 64 bit application, or if you cant do that, set the LARGEADDRESSAWARE flag. Being large address aware will give you a 4GB address space instead of 2GB under 64 bit Windows (which is not as much as a true 64 bit app, but already much more).

Unluckily at least the version of [font="Courier New"]ld[/font] that I am using seems unable to set LARGEADDRESSAWARE (it supports an option for it, but nothing happens), but you can do it with a third party tool in any case (such as CFF Explorer).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement