Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Brainstorm
  4. Out of memory handling

Out of memory handling

Scheduled Pinned Locked Moved Brainstorm
6 Posts 4 Posters 4.3k Views
  • 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.
  • F Offline
    F Offline
    Franzk
    wrote on 6 Sept 2010, 14:06 last edited by
    #1

    Most modern day programs don't seem to bother too much about running out of memory. However, when using large data sets, you could run into this (2G footprint on 32bit systems). How do you manage this, if you manage it at all? Do you care if your program crashes from memory over-use? Do you try to stop it from crashing somehow?

    "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

    http://www.catb.org/~esr/faqs/smart-questions.html

    1 Reply Last reply
    0
    • Y Offline
      Y Offline
      Yash
      wrote on 6 Sept 2010, 15:07 last edited by
      #2

      I guess RAM uses physical hardisk also for virtual RAM. There is no chance you can consume 1 GB in single thread or app.

      http://kineticwing.com : Web IDE, QSS Editor
      http://speedovation.com : Development Lab

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DenisKormalev
        wrote on 6 Sept 2010, 21:49 last edited by
        #3

        Of course it should be handled if there is a big chance of oversizing (as you said 2gb at 32bit). But in most of applications (not taking scientific, finance or something other special things) it happens extremely rare and every such case can be easily protected from such problem.

        1 Reply Last reply
        0
        • F Offline
          F Offline
          Franzk
          wrote on 7 Sept 2010, 09:32 last edited by
          #4

          Let's talk special here. We have an application that can consume up to 2G in 32 bit builds. It is a rather complex thing, and there is no absolute certainty where the bad_alloc will occur. I haven't been able to find an awful lot of information about it yet and since PCs have a crap load of memory these days, the issue is largely ignored. A lot of applications will indeed never even reach the 1G memory use (or the .5G for that matter). Would you think there are best practices in those rare cases?

          "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • F Offline
            F Offline
            Franzk
            wrote on 7 Sept 2010, 09:34 last edited by
            #5

            [quote author="Yash" date="1283785663"]I guess RAM uses physical hardisk also for virtual RAM. There is no chance you can consume 1 GB in single thread or app.[/quote]

            void *data = malloc(1073741824);

            "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply
            0
            • L Offline
              L Offline
              laurent bauer
              wrote on 7 Sept 2010, 22:15 last edited by
              #6

              Question : if you just don't have the required memory, can you do something to prevent the crash? Something like:

              • send a warning to the user "you should save your data... memory shortage coming soon... crash following"
              • release unused objects... is impossible in most of the cases
              • manage by yourself an of the core strategy (hand made HD swap)
              • ...

              In most cases, you don't need to wait until the last kb is used. Allocation tests can be performed on big allocations and the turnaround strategy (if any) can be started when more than 80% is used.

              1 Reply Last reply
              0

              2/6

              6 Sept 2010, 15:07

              topic:navigator.unread, 4
              • Login

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