xiezefan / android-test-kit

Automatically exported from code.google.com/p/android-test-kit
1 stars 0 forks source link

NoMatchingViewException leaks Activity #168

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Have a test that fails with a NoMatchingViewException
2. Observe that the related context ( Activity ) can't be GC'd

NoMatchingViewException.rootView will have a reference to mContext. 

mContext might be an Activity. 

If you have a large test suite and a number of NoMatchingViewExceptions, 
eventually you might get an OOME before the rest of the tests can complete.

Possible Solutions:
1. Generate all error strings for NoMatchingViewException in the constructor 
and then release the view references.
2. Use reflection to null out the reference to the mContext reference on all 
the view you are holding.

Original issue reported on code.google.com by YogurtE...@gmail.com on 28 Jul 2015 at 10:04