[Solved] Qt 5 stack memory limit?



  • I'm using Qt 5.1 32 bit for VS2012. My application has a class that gets instantaniated when I press a button on the main form. The class has large arrays. When I try to run the program, it crashes. When I decrease the array sizes by 10 to 1, for example, no problems. The large arrays are for data calculations, Here are the array sizes:

    array1 [100000x4]
    array2 [10000x5]
    array3 [1000x6]
    array4 [100x7]
    array5 [50x8]

    Will using the 64 bit Qt 5 solve my problem?

    I have ported the same program from C# in Visual Studio 2013 compiled for 32 bit, and the code works fine there. I don't know why Qt would be different.

    I'm using Windows 7 SP1 64 bit with 8 GB ram.

    Any help would be appreciated. Thanks in advance.


  • Moderators

    This is a compiler settings and not a Qt specific issue. AFAIK this is fix for the application and cannot be solved by using a machine with more RAM. Going from 32 to 64 bit may have an influence but more as a side issue.

    You do not give any details of what kind of variables you are using. Certainly you should use dynamic memory allocation with "new. ":http://www.cplusplus.com/reference/new/operator new[]/



  • I solved the problem by adding a line to my .pro file:

    QMAKE_LFLAGS_WINDOWS += -Wl,--stack,32000000

    for minGW 32 bit compiler

    and

    QMAKE_LFLAGS += /STACK:32000000

    for msvc 32 bit compiler.

    Runs lightening fast. Only adds 2 MB of memory in Task Manager.

    Thanks for the replies.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.