Results 1 to 20 of 50

Thread: QVector crashes when array size is big

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #24
    Join Date
    Jan 2006
    Location
    Knivsta, Sweden
    Posts
    153
    Thanks
    30
    Thanked 13 Times in 12 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: QVector crashes when array size is big

    Qt Code:
    1. #include <stdio.h>
    2. #include <unistd.h>
    3.  
    4. struct myStruc {
    5. int array[3000*2000];
    6. };
    7.  
    8.  
    9. void foo(const myStruc &v)
    10. {
    11. printf("%d\n", v.array[1]);
    12. }
    13.  
    14. int main(int , char* [])
    15. {
    16. printf("hello\n");
    17. fflush(stdout);
    18. sleep(1);
    19.  
    20. myStruc currentStruc;
    21. foo(currentStruc);
    22. }
    To copy to clipboard, switch view to plain text mode 

    The above also crashes without printing hello, and now there isn't any Qt code left! Seems like a compiler or OS problem.
    Last edited by drhex; 25th February 2009 at 21:36.

Similar Threads

  1. How to find best size for QTableWidget?
    By plamkata in forum Qt Programming
    Replies: 3
    Last Post: 24th July 2008, 19:07
  2. QT-wince and QHttp::readAll() trouble....
    By AcerExtensa in forum Qt for Embedded and Mobile
    Replies: 6
    Last Post: 12th June 2008, 09:40
  3. QLabel size policy
    By Caius Aérobus in forum Qt Programming
    Replies: 3
    Last Post: 7th December 2007, 17:57
  4. Replies: 1
    Last Post: 24th October 2006, 16:40
  5. Qt 4.1.1 linker warnings
    By Matt Smith in forum Installation and Deployment
    Replies: 0
    Last Post: 26th February 2006, 22:14

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.