Unsolved How to increase the heap size for a Qt Application
-
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.
-
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 ?
-
@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. ?
-
@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...!
-
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.