PDA

View Full Version : I need like 4GB for my program, how do I allocate 4GB?



bmn
22nd February 2014, 07:26
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt

SOURCES += main.cpp

QMAKE_LFLAGS += /LARGEADDRESSAWARE

do i just have to put this in the .pro file of my project "main"?

ChrisW67
22nd February 2014, 07:52
If you are running on a 32-bit Windows system then you will not be able to allocate 4GB either in a single block or in pieces: your process is limited to 3GB:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa366778%28v=vs.85%29.aspx#memory_limits

If you are running a 64-bit Windows executable then you should not need to do anything special.

bmn
22nd February 2014, 21:07
i have a 64 bit operating system, but the program still crashes

Added after 29 minutes:

I am using QTCREATOR, btw.

ChrisW67
22nd February 2014, 21:32
A 64-bit operating system is not the same as a 64-bit executable. A 32-bit executable on a 64-bit OS has the same limits as a 32-bit application on a 32-bit OS.

Assuming you are actually running a 64-bit executable then it may be there is no contiguous block of 4GB to allocate, that you are using structures with 32-bit int size limits, that you doing something unrelated that crashes... My crystal ball is out for polishing. Perhaps you could share what your program is doing, where and how it "crashes"?

This has nothing to do with QtCreator, which is just a fancy text editor that can run your code through a C++ compiler.