Important: Please read the Qt Code of Conduct -

Not enough memory?

  • I am dealing with NI DAQmx and they define unsigned long as uInt32. I declare uInt32 array [1048*1024] in the header file and it compiles, but when I try to run it, it seems to freeze, and when I stop it, it exits with an error:

    @The program has unexpectedly finished.
    D:\Projects\build-BlackAndWhite12bit-Desktop_Qt_5_1_1_MinGW_32bit-Debug\debug\BlackAndWhite12bit.exe exited with code -1073741571@

    Well, it does not say that there is not enough memory, but since I allocate 410481024 = 4,292,608 bytes, and my version is Qt Creator 2.8.1 Based on Qt 5.1.1 (MSVC 2010, 32 bit) on Win7 x64, I expect it to not have enough memory.

    I found a similar question "here":, but the only solution that works for me, would be, probably, moving to 64bit. But how do I do that? I tried to download the application from this website with the "Qt 5.2.1 for Windows 64-bit (VS 2012, 556 MB)": link. But when I got it, it seems to be a 32bit version configured for 64bit. Is this the one I need? Do I need openGL?

    Is there a way to allow more memory for my current QT version?
    Any other ways to go around my problem?

  • Your app allocates only 4Mb which perfectly fits in 32bit memory model (4Gb max).

    I would suggest to run your app under debugger and find where it freezes.
    Or put bunch of prints to trace your code.

  • Lifetime Qt Champion


    Just to make sure I understood you correctly, is that array allocated on the stack ? If so and depending on the current limit you are just eating the complete stack. You should rather allocate that kind of array on the heap. Or since you are using Qt, use a QVector that will handle that for you.

  • @SGaist You are indeed right. It looks like it was initially allocated on the stack. After using QVector, things went better. (I got the answer from

  • Lifetime Qt Champion

    Good :)

    Since you have it working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

Log in to reply