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 the same unit-test files into my real app target and simply invoke them all from the app itself at runtime. Any better ideas?
The best approach to checking for the existence of a memory leak in your application is by looking at your RAM usage and investigating the total amount of memory been used versus the total amount available. Evidently, it is advisable to obtain snapshots of your memory's heap dump while in a production environment.
To detect memory leaks you should run the app and navigate through all possible flows and open several times the same view controllers, then enter memory graph debugger and look at the memory heap. Look for objects that shouldn't be in memory, for example: A view controller that is no longer present in the app.
Any new illegal uses of memory and memory leaks are detected and reported through the CI system. The CI system's test reports provide transparency to a problem that is often undetected until it is too late. Generation of memory result files allows for follow-on detailed analysis of the application's use of memory.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With