Results 1 to 5 of 5

Thread: QList: Out of Memory Error

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2009
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default QList: Out of Memory Error

    I've been trying to work around this runtime mayhem for past 24 with no avail.
    I'm a beginner, and have no knowledge about the inbuilt debugger in Qt4. I've tried to run the program sans the Qt GUI, and it works fine.

    I've narrowed down the OOM killer to a function getWildCards(word); But I'm not sure what wrong I'm doing in there and moreover I'm not using QList anywhere in the entire program to get that error.

    Qt exits the program with a "Microsoft Visual C++ Runtime Error" and a code 3.

    Here's the code snippet.

    Qt Code:
    1. void MainWindow::spellCheck() { //a private slot
    2. QByteArray qB = ui->lineEditWord->text().toLatin1();
    3. char* word = (char *) qB.data(); //casts QByteArray to char*
    4. QString string;
    5.  
    6. ui->txtEditMain->insertPlainText(" ");
    7. ui->txtEditMain->insertPlainText(ui->lineEditWord->text());
    8.  
    9. ui->txtEditSpell->setText(QString::null);
    10.  
    11. WDict->spellcheck(word,2); //calls a spellchecker, WDict is a private *member
    12. for(int i=0; i<WDict->sw.ubound; i++) { //WDict->sw.ubound is upper bound for the iteration
    13. string = (QString(QLatin1String(WDict->sw.valid_words[i])).toLower());
    14. if(string.isEmpty()!=true)
    15. ui->txtEditSpell->append(string);
    16. string.clear();
    17. }
    18. ui->lblSpell->setText(QString::number(WDict->sw.ubound).append(" Spellings"));
    19.  
    20. ui->txtEditWild->setText(QString::null);
    21. ui->lineEditWord->setText(QString::null);
    22. getWildcards(word); //<--------the problem occurs when this function is called
    23. }
    24.  
    25. void MainWindow::getWildcards(char* word) { //the problematic function!
    26. QString string2;
    27.  
    28. WDict->trie_wildcard_print(word); //calls a function which works perfectly fine
    29. for(int i=0; i<WDict->sw.ubound; i++) { //on an average ubound is about 300
    30. string2 = QString(QLatin1String(WDict->sw.valid_words[i])); //valid_words is 600long and 64wide
    31. string2.toLower();
    32. ui->txtEditWild->append(string2);
    33. string2.clear();
    34. }
    35. ui->lblWild->setText(QString::number(WDict->sw.ubound).append(" Wild Cards"));
    36. }
    To copy to clipboard, switch view to plain text mode 


    Merci en avance.
    Last edited by ignoramous; 15th May 2009 at 06:05.

Similar Threads

  1. Compile 4.4.0
    By LordQt in forum Installation and Deployment
    Replies: 18
    Last Post: 29th May 2008, 13:43
  2. QPSQL driver in windows
    By brevleq in forum Installation and Deployment
    Replies: 31
    Last Post: 14th December 2007, 12:57
  3. Error compiling psql plugin
    By vieraci in forum Installation and Deployment
    Replies: 4
    Last Post: 7th October 2007, 02:49
  4. qt 4.2.2 install on aix
    By try to remember in forum Installation and Deployment
    Replies: 2
    Last Post: 28th March 2007, 12:19
  5. Qt-x11-commercial-src-4.2.0-snapshot-20060824 error
    By DevObject in forum Installation and Deployment
    Replies: 4
    Last Post: 24th August 2006, 23:31

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.