free hit counter

Tuesday, July 12, 2011

memory leak check in unit tests



I'd like to easily check for memory leaks inside my unit tests, and it seems that lots of other people want to as well, but it's not natively supported under Linux:

http://stackoverflow.com/questions/3559938/memory-leak-unit-test-c
http://stackoverflow.com/questions/169058/memory-leak-detection-while-running-unit-tests
http://stackoverflow.com/questions/2980917/c-is-it-possible-to-implement-memory-leak-testing-in-a-unit-test
http://stackoverflow.com/questions/3652028/unit-testing-memory-leaks

Score one point for Redmond, apparently this is supported in MSVC under Windows; it's even implemented in Boost::Test.

However, under Linux it looks like people who want to do this are running their unit test suite under valgrind, or compiling each unit test into its own executable and running valgrind on that.

Labels: ,

0 Comments:

Post a Comment

<< Home