Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to increase the heap size for a Qt Application
Forum Updated to NodeBB v4.3 + New Features

How to increase the heap size for a Qt Application

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 3 Posters 3.8k Views 1 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.
  • chaithubkC Offline
    chaithubkC Offline
    chaithubk
    wrote on last edited by
    #1

    I am developing an Embedded application which has multiple user interface windows. I am planning to cache all the windows upfront and bring the necessary window to the user based on the user action. While I try to cache all the windows i notice that I ran out of memory. Is there a mechanism to increase the heap size for a Qt application so that the application can handle the static user interface windows created all at once during boot up ? How do I check the default heap size allocated for my application. ? How do I check the amount of size I need to allocate for the heap so that all the necessary windows can be created upfront and cached.

    Thank you for any help.

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

      Hi,

      The heap size depends on the amount or RAM available on your device and if you are running a 32 or 64 bit application.

      What does your device provide ? How much do you need ?

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

      chaithubkC 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        The heap size depends on the amount or RAM available on your device and if you are running a 32 or 64 bit application.

        What does your device provide ? How much do you need ?

        chaithubkC Offline
        chaithubkC Offline
        chaithubk
        wrote on last edited by
        #3

        @SGaist I have a 1GB RAM and it's a 32 bit application. Regarding how much do I need to allocate, I will have to check. But I was interested to see if I can ever increase the heap size or was it always a fixed default ? If we can increase the heap size, how can I do that and is there a limitation in terms of maximum that I can allocate for the better performance. ?

        JonBJ 1 Reply Last reply
        0
        • chaithubkC chaithubk

          @SGaist I have a 1GB RAM and it's a 32 bit application. Regarding how much do I need to allocate, I will have to check. But I was interested to see if I can ever increase the heap size or was it always a fixed default ? If we can increase the heap size, how can I do that and is there a limitation in terms of maximum that I can allocate for the better performance. ?

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @chaithubk
          Heap size is normally physical RAM available + whatever swap space can be used. I don't know if embedded apps allow any swap space. You do not normally have any control on heap size. If you really want to, I don't think it would have anything to do with Qt. have a look at, say,
          https://stackoverflow.com/questions/5578008/visual-c-possible-to-limit-heap-size
          https://forum.unity.com/threads/how-to-limit-heap-size-on-linux.466779/

          Unless @SGaist knows better...!

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

            Since it's a 32bit application, you won't get more than 2GB but you need a system that has enough resources for that.

            As @JonB explained, physical RAM + SWAP. Depending on the embedded system, SWAP may be available but you usually avoid it as it can wear out the device storage quicker if used intensively and in any case, it means that your system is going to slow down because it has to swap memory pages between RAM and HDD/SSD/Flash/whatever storage you are using.

            You also have to take into account that your application is likely not the only thing that will be running on your system.

            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
            2

            • Login

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