6

I have a metric ton of Unit Tests using Google Test.

Currently using XCode, I have noticed some other testing frameworks that detect memory leaks at the end of each unit test, and I assume there is a prescribed way to do the same thing with Google Test. I hope this isn't a feature of Boost Test and a few others only.

If anyone could point me in the right direction, I would appreciate it. Rather avoid switching test frameworks.

Right now, I'm thinking valgrind might be worth looking into, I'm just unsure how I'll hook into each test. My guess is I won't be able to do this from xcode directly.

  • I have composed a solution of mine - feel free to have a look:https://stackoverflow.com/questions/2980917/c-is-it-possible-to-implement-memory-leak-testing-in-a-unit-test/44737357#44737357 – Guy Avraham Jun 24 '17 at 14:21

1 Answers1

7

As far as I know, unit tests for memory leaks are not explicitly supported in Google Test. Nevertheless, you have this extension that fills that part for you

jpmuc
  • 1,092
  • 14
  • 30