Details
-
Bug
-
Resolution: Won't Do
-
P3: Somewhat important
-
None
-
5.9.9, 5.12.6, 5.15.0, 5.15.2, 5.15.3
Description
There is increase in memory usage due to QObject::connect and QObject::disconnect calls when the application creates objects at an interval of 50 ms in a separate thread. In MainWindow, the previously created object's destroyed() signal is disconnected from the slot and the pointer to the newly created object is copied to the local member variable. Then the newly created object's destroyed signal is connected to a slot. Each object will create a buffer of 1000 bytes internally. The pointer to object will be stored in a list which is a member variable of the object creation thread. The memory consumption increases faster with connect/disconnect calls than without.
Means to reproduce:
1. build and run the attached example project with Qt version 5.15.3
2. Press Start button.
3. Wait for timer to stop
4. Check the memory usage of the application.
Then
5. Close the application and rerun it
6. Check "Use Connect" check box
7. Press Start Button
8. Wait for timer to stop
9. Check the memory usage of the application.
10. Compare the memory usage of these two runs.
There is an option to do longer test runs included instead of the 5 minute one.