Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
532 views
in Technique[技术] by (71.8m points)

c++ - Suppression files for Qt memory leaks with Valgrind

I usually write my classes in C++ and check if they leak memory using valgrind on Linux platform. I'm not satisfied until all the heap memory is freed.

Starting to write in Qt, I found how many leaks valgrind detects, also on a simple project. They are so many that it's difficult to detect my same leaks.

I read somewhere that is possibile to use a suppression files for valgrind which helps filtering out the unwanted leaks, but I can't find it.

I'm using Ubuntu 11.04 x64, g++ 4.5, Qt 4.7. Does somebody know how to cope with this problem?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Did you look at this "Valgrind Suppression File Howto" wiki?

Just for the record there are some underlying libraries in Qt (especially the ones in the painting process) which always leak small amount of memory. These are the one you need to suppress.

As you said, you should first create a minimal project, run it to create a valgrind suppression file and then apply that suppression file to your project.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...