Dynamic Memory Limit with operator new

Hi,

In my platform, Windows 7 Ultimate 64 bits with Service Pack 1 over a x86-64 AMD microprocessor, AMD Phenom II 1090T X6, with a total of 4 GBytes of RAM memory), one C++ program can only allocate up to 2 GBytes of dynamic memory (using operator new, so Heap memory).

In am using the IDE Microsoft Visual C++ 2010 Express Edition to compile my C++ program and generate the executable file (for Win32).

In my system, there are much more available memory than 2 GBytes (yet remain 1 GByte of RAM memory and the virtual memory), so, Why can't my C++ program allocate more than 2 GBytes of memory? Do I need to configure something in the IDE to allow more memory to the program?

Thanks.
Last edited on
If you built your program for 32 bit then it can access 2GB memory.
See here http://msdn.microsoft.com/en-us/library/aa366778.aspx
Microsoft Visual C++ 2010 Express Edition doesn't allow to change the platform (Win32), so How can I generate the executable file for Win64? Maybe Microsoft Visual Studio Express 2013 allows to change the platform to Win64?

Thanks.
Last edited on
You need to install tools for compilation for Win64. If you already done so then run config manager from Build menu and create a new platform.

Build->Configuration Manager, expand "Active Solution Platform" select new, select x64 from "Type of select new platform"

Then while building select x64 build in either Debug or Release configuration
Microsoft Visual C++ 2010 Express Edition doesn't allow to change the platform (Win32), so How can I generate the executable file for Win64?

This is an intentional limitation placed on Express Edition by Microsoft. You want the 64 bit tools, buy one of the paid versions of VS or use open source compilers capable of generating a 64 bit executable.
I just wanted to add that Windows partitions your virtual memory into two address spaces, one for the processes to use and one for the system. Go ahead and run the "TestLimit" utility that Mark Russinovich talks about in his blog here to see what I mean: http://blogs.technet.com/b/markrussinovich/archive/2008/11/17/3155406.aspx

It's not really clear which part gets more of the physical RAM and which one has to deal with more page file space but I'd image that the System side of the division would need more non-cachable allocations then applications would.
Topic archived. No new replies allowed.