My Qt/Windows application is running out of user handles, as the application contains a huge amount of widgets. What can be done about this ?
Answer:
In Qt versions below Qt 4.4, Qt will store a user handle for every widget in the application, including child widgets. This means that for every font, widget and so on, a user handle will be created and taking up memory. So having a huge amount of widgets can cause you to run into the user handles limit of windows. To solve this problem you should delete your widgets when they are being closed and recreate them when needed. Alternatively, you can paint your widgets instead of creating widgets, which is much more light weight.
Starting with Qt 4.4 we are using "Alien" which will give your application handle-less child widgets, causing it to be much more light-weight and resource friendly as we don’t allocate user handles for every single widget. We only allocate user handles for top level widgets. See:
http://labs.trolltech.com/blogs/2007/08/09/qt-invaded-by-aliens-the-end-of-all-flicker