Description
By looking at the memory usage of QDBusConnection it seems that over time it is using an increasing amount of memory when Objects are dynamically registered and unregistered. The memory consumption was detected using Massif, valgrind's heap profiler.
Looking at the Qt code in QDBusConnection::unregisterObject() shows that when an object is unregistered it first tries to find the corresponding node (ObjectTreeNode) for the path and then resets the node. However the node that was found itself is never removed and stays in memory indefinitely. The node may not be used ever again. This can become problematic over a longer period of time.
I have created a small test application to be able to target this issue specifically (see attaches source files). The application continuously registers and unregisters an object at D-Bus. Using a heap profiler shows that memory consumption is increasing. When applying a small patch to the Qt sources to remove the node itself in the described situation, the incrementation of the memory consumption disappears. I didn't add the patch here (yet) because it probably has some unwanted side effects.