Solved Memory usage spike with Qt3D
-
Dear all,
in one of the software I'm responsible, I'm trying to get rid of an outdated version of 3D visualisation library and would like to use Qt3D to do the job.
I started with a simple (at least that's what I though) application: points in space are generated and their colour should change according to some criteria. Before I used 2 projections and QGraphicsView to represent the data.
I am on Windows 10, using MSVC 2013 with Qt 5.6.2 64bits.
For each generated points I use a spherical mesh (the same for each point), set the material and transformation. The thing I see is that for about 1300 points the memory usage for the application goes up to something like 2 GB, but after a while it goes down to something like 80 MB!I could imagine 1300 meshes are a lot, this is why I only use 1 instance of
QSphereMesh
andQPhongMaterial
(I only use 1 colour at this stage) which are used by my 1300QEntity
instances, and I reduced the spherical mesh quality (anyway they will be looked at from far away). But still I find a bit odd that the memory behaves like this.Is this normal? If yes, is there smarter way of coding this in order to reduce the initial memory usage?
Please find a test project illustrating the aforementioned behaviour:
.pro file
Windows.h
Windows.cpp
mainwindow.h
mainwindow.cpp
main.cpp -
Hi,
If possible, try with the latest LTS: 5.9. There's work that has been done to improve both CPU and memory consumption.
-
@SGaist said in Memory usage spike with Qt3D:
Hi,
If possible, try with the latest LTS: 5.9. There's work that has been done to improve both CPU and memory consumption.
I'll give a try and let you know. Thing is the Qt3D part seems not to be compatible (as far as I've seen) between 5.6.2 and 5.9.1
-
@SGaist You've just made my day!
Now the scene is rendered immediately and memory an initialisation is about 180 MB for ~1300 meshes.