Results 1 to 3 of 3

Thread: Problem with malloc

  1. #1
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Problem with malloc

    Hello!

    Since recent times I don't stop receiving messages of malloc problems in my software. Here is one example:

    Qt Code:
    1. *** glibc detected *** /home/martin/Documentos/Programas Qt/Servidor 3.5.v3/Servidor: malloc(): smallbin double linked list corrupted: 0x08bc9e60 ***
    To copy to clipboard, switch view to plain text mode 

    This "double linked list corrupted" is one of the most common ones. What is strange is that some times the software runs without problems and in others, without changing the code, it works.

    Does somebody knows what this malloc messages means?

    What is even more interesting is that the errors occur in different parts of the program,making it hard to see exactly where the problem is. Sometimes it runs till a considerable portion, but in others it doesn't make to much. In my last try, another error appeared:
    Qt Code:
    1. *** glibc detected *** /home/martin/Documentos/Programas Qt/Servidor 3.5.v3/Servidor: malloc(): smallbin double linked list corrupted: 0x0a0020f8 ***
    To copy to clipboard, switch view to plain text mode 


    Thanks!

    P.s.: the complete error message:
    Qt Code:
    1. *** glibc detected *** /home/martin/Documentos/Programas Qt/Servidor 3.5.v3/Servidor: malloc(): smallbin double linked list corrupted: 0x08bc9e60 ***
    2. ======= Backtrace: =========
    3. /lib/tls/i686/cmov/libc.so.6(+0x6b591)[0x9eb591]
    4. /lib/tls/i686/cmov/libc.so.6(+0x6e710)[0x9ee710]
    5. /lib/tls/i686/cmov/libc.so.6(__libc_malloc+0x5c)[0x9eff9c]
    6. /home/martin/QtSDK/Desktop/Qt/473/gcc/lib/libQtCore.so.4(_Z7qMallocj+0x1d)[0x17b96d]
    7. /home/martin/QtSDK/Desktop/Qt/473/gcc/lib/libQtCore.so.4(_ZN10QByteArrayC1EiN2Qt14InitializationE+0x2b)[0x184f2b]
    8. /home/martin/QtSDK/Desktop/Qt/473/gcc/lib/libQtCore.so.4(+0x1c0ce8)[0x2d0ce8]
    9. /home/martin/QtSDK/Desktop/Qt/473/gcc/lib/libQtCore.so.4(_ZNK10QTextCodec11fromUnicodeERK7QString+0x39)[0x2c9ab9]
    10. /home/martin/QtSDK/Desktop/Qt/473/gcc/lib/libQtCore.so.4(_ZNK7QString11toLocal8BitEv+0x3b)[0x1d92eb]
    11. /home/martin/QtSDK/Desktop/Qt/473/gcc/lib/libQtCore.so.4(+0x107d19)[0x217d19]
    12. /home/martin/QtSDK/Desktop/Qt/473/gcc/lib/libQtCore.so.4(_ZN5QFile10encodeNameERK7QString+0x2c)[0x217b7c]
    13. /home/martin/QtSDK/Desktop/Qt/473/gcc/lib/libQtCore.so.4(+0x155b42)[0x265b42]
    14. /home/martin/QtSDK/Desktop/Qt/473/gcc/lib/libQtCore.so.4(_ZN13QFSFileEngineC1ERK7QString+0x94)[0x25fc64]
    15. /home/martin/QtSDK/Desktop/Qt/473/gcc/lib/libQtCore.so.4(_ZN19QAbstractFileEngine6createERK7QString+0xbf)[0x20864f]
    16. /home/martin/QtSDK/Desktop/Qt/473/gcc/lib/libQtCore.so.4(_ZN9QFileInfoC1ERK7QString+0x34)[0x21ec34]
    17. /home/martin/QtSDK/Desktop/Qt/473/gcc/lib/libQtCore.so.4(_ZN5QFile6existsERK7QString+0x2c)[0x217e3c]
    18. /home/martin/QtSDK/Desktop/Qt/473/gcc/lib/libQtCore.so.4(_ZNK4QDir6existsERK7QString+0x61)[0x20d551]
    19. /home/martin/Documentos/Programas Qt/Servidor 3.5.v3/Servidor[0x8054113]
    20. /home/martin/Documentos/Programas Qt/Servidor 3.5.v3/Servidor[0x80538a8]
    21. /home/martin/Documentos/Programas Qt/Servidor 3.5.v3/Servidor[0x80526db]
    22. /home/martin/QtSDK/Desktop/Qt/473/gcc/lib/libQtNetwork.so.4(+0xcde60)[0x6e5e60]
    23. /home/martin/QtSDK/Desktop/Qt/473/gcc/lib/libQtNetwork.so.4(+0xb3a3b)[0x6cba3b]
    24. /home/martin/QtSDK/Desktop/Qt/473/gcc/lib/libQtNetwork.so.4(+0xb4caf)[0x6cccaf]
    25. /home/martin/QtSDK/Desktop/Qt/473/gcc/lib/libQtGui.so.4(_ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent+0xbc)[0xeddd7c]
    26.  
    27.  
    28. etc.
    To copy to clipboard, switch view to plain text mode 


    Added after 1 53 minutes:


    Another constant problem:

    Qt Code:
    1. Servidor: malloc.c:4630: _int_malloc: Assertion `(unsigned long)(size) >= (unsigned long)(nb)' failed.
    To copy to clipboard, switch view to plain text mode 
    Last edited by Momergil; 15th August 2011 at 15:14.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Problem with malloc

    It means that the internal data that malloc uses to track memory allocations is being corrupted. This is most likely the result of your program performing out-of-bounds accesses on raw memory blocks allocated by malloc. The triggering event is related to line 19 in the back trace. You should run a debug version in the debugger to find out what that region of you code is doing.

  3. #3
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Problem with malloc

    Quote Originally Posted by ChrisW67 View Post
    It means that the internal data that malloc uses to track memory allocations is being corrupted. This is most likely the result of your program performing out-of-bounds accesses on raw memory blocks allocated by malloc. The triggering event is related to line 19 in the back trace. You should run a debug version in the debugger to find out what that region of you code is doing.
    Thanks, Chris. I was able to solve the problem.

    God bless.

Similar Threads

  1. Replies: 2
    Last Post: 7th December 2010, 15:13
  2. Hitting memory limits for malloc() at about 1.7GB?
    By Skywalker in forum Qt Programming
    Replies: 7
    Last Post: 8th July 2009, 02:44

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.