Hello Kai
What test is running when it gets into the infinite loop?
Maybe you tried this, but here is what I would do, collect information:
Run the tests with -v verbose. See which test is getting stuck.
Once you know the test, use the -g and -n switches to select the test
group, or the test name to run the test in isolation.
You might try other tests in the same group and make sure it is just the
one test. If it is more than one test, that is information to help you
debug this. When you get to one test that has the infinite loop, can
you cut the example down to try to establish cause and effect.
Did the infinite loop happen with some change you made (while test
driving) or were these tests added after development? If via TDD, back
out the change. Again cause and effect.
I C and C++ if your code goes out of bounds of where it is supposed to
go, that is undefined behavior. Given the couple emails I read, sound
like your code has run off and clobbered something, hence the endless
loop. A problem like this can exist for years in code that appear to be
working fine.
I saw your comment about no comments. We have something better, tests
:-). You have a repeatable problem! BTW: that code is walking down a
linked list. I suspect the production code damages some link in the
list.
To confirm you are in that loop, I suggest you change your assert to
look at total_leaks. Make it some number larger that the number of
allocations you would expect (by a factor of 2) like this
assert(total_leaks < 200); The assert you have will terminate way too
soon, like on the first leak when there is more that one and it is not
the first leak. Doesn't that stack trace suggest the code was in
"isInPeriod()"?
Good luck, but more importantly, good skill!
James
--------------------------------------------------------------------------
James Grenning - Author of TDD for Embedded C -
wingman-sw.com/tddec
wingman-sw.com
wingman-sw.com/blog
twitter.com/jwgrenning
facebook.com/wingman.sw
[](http://wingman-sw.com)