QProgressBar makes an application consume much memory

143 views Asked by At

For days, maybe weeks, I have been looking for a memory leak in my application. I didn´t find where it can be until I found this:

https://bugs.kde.org/show_bug.cgi?id=292217

After checking everything, I discover that QProgressBar takes too much memory every time Qt renders the status of the progress bar. In my case, I was also changing the size of the progress bar, so it makes that Qt memorizes more and more readers.

It can takes about 20 MB per day, and since my application is a 24/7 application, it is not possible to live with that.

My solution was to keep the progress bar always the same size, but my client wants the QProgressBar changes the size.

Does anybody know how to keep this memory usage within some limits?

Cheers.

System:

Win 7 Aero Qt 5.0.2 Visual Studio 2010 Boost 1.52 No MFC, No ATL

1

There are 1 answers

0
Jeremy Friesner On

Some possible workarounds:

1) Upgrade to a new version of Qt in which this bug is fixed (if it exists)

2) Use a different QStyle that doesn't contain this bug (as suggested by CmdrMoozy)

3) Compile Qt from source and patch the Qt source to fix this bug; distribute your patched version of Qt

4) Write your own progress bar class (i.e. subclass QWidget and override paintEvent()) and use that instead of QProgressBar.