Results 1 to 3 of 3

Thread: Memory Error

  1. #1
    Join Date
    May 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Memory Error

    Hello All,
    I was wondering what kind of wrong coding could run that kind of error :

    It happens when I quit my program :
    Qt Code:
    1. ======= Memory map: ========
    2. 08048000-080e8000 r-xp 00000000 08:08 240106 /home/anthony/Bureau/DOUCHE/TALC/Talc
    3. 080e8000-080e9000 r--p 000a0000 08:08 240106 /home/anthony/Bureau/DOUCHE/TALC/Talc
    4. 080e9000-080ea000 rw-p 000a1000 08:08 240106 /home/anthony/Bureau/DOUCHE/TALC/Talc
    5. 080ea000-080eb000 rw-p 080ea000 00:00 0
    6. 0925c000-0a3a9000 rw-p 0925c000 00:00 0 [heap]
    7. af700000-af721000 rw-p af700000 00:00 0
    8. af721000-af800000 ---p af721000 00:00 0
    9. af852000-b0263000 r--p 00000000 08:08 442431 /usr/share/fonts/truetype/sazanami/sazanami-mincho.ttf
    10. b0263000-b0269000 r--p 00000000 08:08 807923 /usr/share/fonts/truetype/latex-xft-fonts/cmsy10.ttf
    11. b0269000-b02db000 r--p 00000000 08:08 385554 /usr/share/fonts/truetype/freefont/FreeSans.ttf
    12. b02db000-b0301000 r--p 00000000 08:08 856396 /usr/share/fonts/truetype/ttf-telugu-fonts/lohit_te.ttf
    13. b0301000-b032f000 r--p 00000000 08:08 856378 /usr/share/fonts/truetype/ttf-kannada-fonts/lohit_kn.ttf
    14. b032f000-b0342000 r--p 00000000 08:08 420848 /usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_hi.ttf
    15. b0342000-b0356000 r--p 00000000 08:08 420849 /usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_gu.ttf
    16. b0356000-b0378000 r--p 00000000 08:08 856362 /usr/share/fonts/truetype/ttf-bengali-fonts/lohit_bn.ttf
    17. b0378000-b0594000 r--p 00000000 08:08 680121 /usr/share/fonts/truetype/unfonts/UnDotum.ttf
    18. b0594000-b0cea000 r--p 00000000 08:08 442424 /usr/share/fonts/truetype/sazanami/sazanami-gothic.ttf
    19. b0cea000-b0d18000 r--p 00000000 08:08 420846 /usr/share/fonts/truetype/ttf-indic-fonts-core/MuktiNarrow.ttf
    20. b0d18000-b212d000 r--p 00000000 08:08 442400 /usr/share/fonts/truetype/arphic/uming.ttc
    21. b212d000-b218d000 rw-s 00000000 00:09 1343501 /SYSV00000000 (deleted)
    22. b218d000-b218f000 rwxp 00000000 00:0f 766 /dev/zero
    23. b218f000-b35a4000 r--p 00000000 08:08 442400 /usr/share/fonts/truetype/arphic/uming.ttc
    24. b35a4000-b35b8000 r--p 00000000 08:08 418755 /usr/share/fonts/type1/gsfonts/n019003l.pfb
    25. b35b8000-b3644000 r--p 00000000 08:08 680038 /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf
    26. b3644000-b3695000 r--p 00000000 08:08 685067 /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-ExtraLight.ttf
    27. b3695000-b36d8000 rw-p 00000000 00:0f 766 /dev/zero
    28. b36d8000-b36f9000 r--p 00000000 08:08 550533 /usr/share/fonts/truetype/ttf-liberation/LiberationSans-Regular.ttf
    29. b36f9000-b374b000 r-xp 00000000 08:08 331549 /usr/lib/libtiff.so.4.2.1
    30. b374b000-b374c000 ---p 00052000 08:08 331549 /usr/lib/libtiff.so.4.2.1
    31. b374c000-b374e000 r--p 00052000 08:08 331549 /usr/lib/libtiff.so.4.2.1
    32. b374e000-b374f000 rw-p 00054000 08:08 331549 /usr/lib/libtiff.so.4.2.1
    33. b374f000-b37a1000 r-xp 00000000 08:08 319910 /usr/lib/libQtSvg.so.4.5.0
    34. b37a1000-b37a2000 ---p 00052000 08:08 319910 /usr/lib/libQtSvg.so.4.5.0
    35. b37a2000-b37a3000 r--p 00052000 08:08 319910 /usr/lib/libQtSvg.so.4.5.0
    36. b37a3000-b37a4000 rw-p 00053000 08:08 319910 /usr/lib/libQtSvg.so.4.5.0
    37. b37a8000-b37bf000 r--p 00000000 08:08 856384 /usr/share/fonts/truetype/ttf-oriya-fonts/lohit_or.ttf
    38. b37bf000-b37ef000 r-xp 00000000 08:08 334345 /usr/lib/liblcms.so.1.0.18
    39. b37ef000-b37f0000 r--p 00030000 08:08 334345 /usr/lib/liblcms.so.1.0.18
    40. b37f0000-b37f1000 rw-p 00031000 08:08 334345 /usr/lib/liblcms.so.1.0.18
    To copy to clipboard, switch view to plain text mode 

    Here is what i am doing :

    Qt Code:
    1. TalkWindow::saveConf();
    2.  
    3. list<MotionStyle*>::iterator mScenesIt;
    4. list<Source*>::iterator mSourcesIt;
    5. list<Font*>::iterator mFontsIt;
    6.  
    7. //map<std::string, QTimer*>::iterator mTimersIt;
    8.  
    9. /*if (mDisplayStyle->isStarted())
    10.   mDisplayStyle->stop();*/
    11. TalkWindow::on_stopButton_clicked();
    12.  
    13. delete mDisplayStyle;
    14.  
    15. for (mSourcesIt = mSources.begin(); mSourcesIt != mSources.end(); mSourcesIt++)
    16. {
    17. delete *mSourcesIt;
    18. mSourcesIt = mSources.erase(mSourcesIt);
    19. }
    20.  
    21. for (mScenesIt = mScenes.begin(); mScenesIt != mScenes.end(); mScenesIt++)
    22. {
    23. delete *mScenesIt;
    24. mScenesIt = mScenes.erase(mScenesIt);
    25. }
    26.  
    27. /*for (mTimersIt = mTimers.begin(); mTimersIt != mTimers.end(); mTimersIt++)
    28.   delete mTimersIt->second;
    29.  
    30.   mTimers.clear();*/
    31.  
    32. for (mFontsIt = mFonts.begin(); mFontsIt != mFonts.end(); mFontsIt++)
    33. {
    34. delete *mFontsIt;
    35. mFontsIt = mFonts.erase(mFontsIt);
    36. }
    37.  
    38. if(mCheckInfosTimer)
    39. mCheckInfosTimer->stop();
    40. // delete mCheckInfosTimer;
    41.  
    42. mPomme->destroy();
    43. delete mPomme;
    44. }
    To copy to clipboard, switch view to plain text mode 

    Thank you for everything.

  2. #2
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Memory Error

    Hi,

    First of all, use a debugger to debug your application. Step by step will help you to find the error code line as it is a runtime error.
    Second, it seems that you delete something in the memory and then you tell "mSources" to erase it. Since the memory object has been destroyed it can't be erased and so it crashes.
    Òscar Llarch i Galán

  3. #3
    Join Date
    Apr 2010
    Location
    Rostov-na-Donu, Russia
    Posts
    153
    Thanks
    2
    Thanked 26 Times in 23 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Memory Error

    you shouldn't do mSourcesIt++, mScenes++ and mFonts++ because erase
    Return value
    A random access iterator pointing to the new location of the element that followed the last element erased by the function call, which is the vector end if the operation erased the last element in the sequence.

Similar Threads

  1. OUT OF MEMORY - Error while working with sqlite
    By Askar in forum Qt Programming
    Replies: 1
    Last Post: 27th November 2009, 23:54
  2. QList: Out of Memory Error
    By ignoramous in forum Newbie
    Replies: 4
    Last Post: 18th May 2009, 09:34
  3. Memory error for Qlabel
    By Qt Coder in forum Qt Programming
    Replies: 14
    Last Post: 4th April 2009, 12:03
  4. Replies: 2
    Last Post: 23rd November 2007, 17:44
  5. Replies: 2
    Last Post: 4th May 2006, 19:17

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.