O'Reilly logo

Application Development with Qt Creator by Ray Rischpater

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Finding memory leaks with Valgrind

As we discussed in Chapter 3, Designing Your Application with Qt Designer, you should really get in the habit of using Qt's parent-child relationship when managing memory for classes of QObject in your application to avoid memory leaks. In my time writing Qt applications, the only time I've had to deal with memory leaks was when I didn't do that. In addition, using classes such as QSharedPointer for pointers that aren't based on QObject is a good idea too.

Sometimes, though, you may introduce a memory leak you can't find on your own. In that case, a tool such as Valgrind can be a lifesaver; it tracks every memory allocation and free operation in your application, alerting you when your program terminates if it ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required