Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QLineEdit SetText() causes CPU and Memory Usage increase
naveeng last edited by
We are running Qt 4.6.2 on a ARM board (Debian Linux 2.6.28) with 256MB RAM.
We have a QLineEdit Control where the text is set using setText() every 1 second. Over a period (observed over 2 days) CPU usage and Memory usage reported by top command increases (it started with CPU usage of 4.5% and memory usage of 4.1% and
ended up with around 50% CPU Usage and 10% memory usage after 2 days)
If you do not call setText() or call it with empty string CPU and Memory usage remains constant over a long period.
For testing we replaced the QLineEdit control with QLabel, and there is no CPU or memory usage increase.
Searching over the net and Qt mailing lists, there were some related discussions. QLineEdit has undo/redo feature and buffer, as per the Qt manual undo/redo buffer gets cleared whenever we set the text using setText() method, so I understand this is not an issue.
Not sure what is the issue with QLineEdit and setText(), Please let me know if anybody had similar experience, any solutions or inputs.