Svenn-Arne Dragly

Memory usage improvements in Qt3D

Published Tuesday February 13th, 2018
Comments Off on Memory usage improvements in Qt3D
Posted in OpenGL, Performance, Qt 3D

Together with engineers from KDAB and the Qt community, we are continuing to improve performance and stability of Qt3D. Back in November, I wrote about how we have reduced CPU usage in Qt3D. In this post I would like to share some improvements we have made to reduce memory consumption.

Qt 3D has a flexible architecture that separates the frontend, which runs on the GUI thread, from the backend, which consists of aspects responsible for rendering, input handling, and animation. The aspects are run on a separate thread and can start jobs that are run on a thread pool. This allows Qt 3D to make use of needed CPU resources in parallel, but it also means we need to keep data duplication to a minimum. By reducing the amount of duplicated data and improving the allocation strategy for backend objects, the memory usage has been significantly reduced.

Even small projects benefit from these improvements, such as the Simple C++ example, which uses no textures or other assets:

Simple C++ Example

On my Linux desktop, this example is down from 92 MB in Qt 5.6.3 to 47 MB on Qt 5.9.4:

Qt3D simple-cpp example RAM usage

The same can be seen in more complex applications, such as this internal demo application for an automobile instrument cluster. It is using Qt Quick and Qt 3D to render the dashboard of an electric car. The demo has a number of different views for navigation, media, and a consumption overview. It also renders a live 3D model of the car with multiple textures:

Qt3D and QtQuick instrument cluster

The memory usage in this example has dropped from about 220 MB of RAM in Qt 5.6.3 to 135 MB in Qt 5.9.4:

Qt 3D instrument cluster demo RAM usage

We are working hard to improve performance and stability further in upcoming releases. In Qt 5.10.1 we have improved on-demand rendering performance, while in Qt 5.11 we streamline the order in which rendering jobs are executed. This ensures stability and allows for more performance improvements in the future. In later releases, we will increase data caching between frames to reduce the amount of work even further.

Do you like this? Share it
Share on LinkedInGoogle+Share on FacebookTweet about this on Twitter

Posted in OpenGL, Performance, Qt 3D

Get started today with Qt Download now