Finding memory leaks while running iPhone unit tests
I know how to do Unit Test on iPhone - the logic tests which run during build phase of the "iPhone Unit Test Bundle".
I know how to detect memory leaks using instruments - in XCode, Menu->Run->run with perf tools->Leaks.
How do I do both? I want to run the unit tests and detect memory leaks in them. If I try to simply select unit-test bundle as target and then "Menu->Run->run with perf tools->Leaks" I get the app loading in simulator but the unit test is not run.
The best I could come up with is include th开发者_如何学运维e same unit-test files into my real app target and simply invoke them all from the app itself at runtime. Any better ideas?
There's really no need to check for leaks because they're started up and torn down independently. If you're trying to debug a leak by running the unit tests and seeing if they leak, you're probably better off using something like the clang static analyzer in Xcode 3.2
精彩评论