Important: Please read the Qt Code of Conduct -

Memory allocation problem when running QT

  • Hi all,
    I seem to have memory problem. When I try to allocate memory:
    @double data[104800];@
    I do not get any problems. However, when I increase array size by 10:
    @double data[1048000];@
    the program runs but freezes. Any one has idea how to fix this problem?
    Thank you.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    This is not a Qt specific issue. You are trying to create a table of over 8MByte on the stack which is probably too much.

    Such big tables belongs to the heap. You can also use e.g. a QVector which will handle this for you.

Log in to reply