WHC::IDE #1 – porting to Qt5 and memory leaks

WHC::IDE is an IDE for parallel and distributed projects using OpenCL. My goals in the last two weeks have been porting to from Qt4.8 to Qt5 and fixing leaks.

I do not understand the reason for the changes that made old projects incompatible, but it wasn’t for me to decide. All I could do was to find a way to make it work again. To be honest, it wasn’t that difficult, considering there are many helpful blog posts and articles floating around the internet. I don’t have much to say about this, but if you are interested in porting old projects, the most useful resource I found was this.

After porting, the real work began. I started this project knowing that it has a huge, black hole inducing amount of memory leaks, so I was prepared for the worst. And what I saw seemed bad. After every run, valgrind would leave a 5 MB log (I redirected standard error to a file). The thing that concerned me the most was that I didn’t understand anything from the 5 MB file. The stack trace was too short and I couldn’t see which methods from my code caused the mess. After a quick search, I found the –num-callers parameter that sets the size of the stack trace. Once more, I ran the program with valgrind, this time with a much bigger stack trace limit, and started examining the log file. It showed that almost every error was caused by Qt methods. I went to Google with those errors and I learned that Qt causes a lot of false positives in valgrind and that there is a way to create a suppression file.

A suppression file is used to suppress certain errors that valgrind encounters. The good news is that the QtCreator IDE (the program I use to develop the project) already has valgrind set to suppress the false positives. Running from QtCreator showed that WHC::IDE is much better than I thought. I spent the rest of the time finding real memory leaks and segmentation faults.

Next time I will talk about restoring the running state of a project, in case of a system crash. I strongly believe I’m going to get this working by next week.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>