Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. qBadAlloc - strange problem
Forum Updated to NodeBB v4.3 + New Features

qBadAlloc - strange problem

Scheduled Pinned Locked Moved General and Desktop
12 Posts 3 Posters 3.5k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    LuGRU
    wrote on last edited by LuGRU
    #1

    Hello,
    I run into qBadAlloc issue when running my application.
    Memory usage was around 800MB so I don't hit 2GB (or something around it) limit in 32bit mode.

    Now strange part is:
    In background Firefox was running all day, compilation in release mode (FF still in background) and QByteArray crashed on realloc(), then running in debug same story. Tested on another PC - works fine, tested on MacBook - works fine. After that I closed Firefox and rerun debug session again ... from now on application works just fine. Now I don't run into qBadAlloc() issue on this machine.

    Can any one explain how this is possible, does another 32bit process (Firefox) could cause this issue to happen?

    Thanks for any info.

    EDIT: Affected PC - Windows 8.1 64bit Qt 5.4.2 msvc 2010 - compilation in 32bit mode.
    Anotehr PC (ok) - Windows 8.1 64bit Qt 5.4.2 msvc 2010 - compilation in 32bit mode.
    Mac (ok) - Mac Os X 10.10.3 64bit Qt 5.4.2 - compilation in 64bit mode.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      Hi,

      have you tried to Debug your application and verify when and where the crash happens??

      Do you have some code to show??

      BTW 800MB is a big number!!

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • L Offline
        L Offline
        LuGRU
        wrote on last edited by
        #3

        I run with debugger that's why I know that application crashes in QByteArray realloc function and when allocating more memory fails it do crash.

        This part of code is used to compress data to ZIP file. It's not stream base that's why usage is so high.

        But reall question is why same code (nothing was changed) crashed in debug mode and after closing Firefox and again rerunning application in debug mode problem is resolved.

        Not only that - in application I do have 2 ways to save file to ZIP and using "other" way did work for large file but when used "first" mode it did crash (didn't crash on other PC with WIn 8.1 / Mac 10.10 - run also in debug mode).

        I know that my description is vague but I'm working on large application and I can't go into details here.

        Another question - could to much recursive calls cause throw of qBadAlloc() ?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          Did you check the available memory on your computer when FireFox was running ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • L Offline
            L Offline
            LuGRU
            wrote on last edited by
            #5

            Yes, there was plenty of free memory.
            Also I performed test - closing Firefox and recreating opened tabs - no issue.

            1 Reply Last reply
            0
            • L Offline
              L Offline
              LuGRU
              wrote on last edited by
              #6

              Theory - I will need to test this out but I'm suspecting that issue is related to manually set "Virtual Memory" on system.
              Tested on other applications (many Firefox tabs, memory intense application) and apps did crash - although in event viewer I don't see any crash related to memory per say but this may be a case here).

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                How are you modifying the virtual memory handling on your computer ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  LuGRU
                  wrote on last edited by
                  #8

                  Like this: http://windows.microsoft.com/en-us/windows/change-virtual-memory-size#1TC=windows-7

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Are you increasing or decreasing the available Virtual Memory ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • L Offline
                      L Offline
                      LuGRU
                      wrote on last edited by
                      #10

                      I tried both - now I cant reproduce issue.

                      When issue with qBadAlloc() occured virtual was set to "automatic" - so no limitation's issue.

                      At this point I'm out of ideas. Now application works perfectly fine - with no code change.

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        Then there's only one answer: gremlins...

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • L Offline
                          L Offline
                          LuGRU
                          wrote on last edited by
                          #12

                          Unfortunately no gremlins here, just trolls :D

                          I run some more test and nothing come up so I can't explain why application do crash for same input data but memory do spikes to much so I'm redesigning some mem intensive parts.

                          Thanks for the input.

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved