title: Test failed to run to completion. Reason: 'Instrumentation run failed due to 'Process crashed. when using Espresso
body: <p>I have around 200 tests running using Espresso. Most of them are large tests. While tests are running app gets crashed and in logs it says, </p>
  
  <blockquote>
    <p>Test failed to run to completion. Reason: 'Instrumentation run failed due to 'Process crashed.></p>
  </blockquote>
  
  <p>I assume its due to OutOfMemory issue. Is there any fix available to clear memory in teardown method, so that we can clear memory after each test finishes? Or is there any other work around to fix this issue? I have tried using android:largeHeap="true" in test manifest file. But its not working. Here is the complete log,</p>
  
  <pre><code>java.lang.OutOfMemoryError: Failed to allocate a 50452 byte allocation with 43158 free bytes and 42KB until OOM
  at java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:95)
  at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:163)
  at java.lang.StringBuilder.append(StringBuilder.java:288)
  at java.lang.StringBuilder.append(StringBuilder.java:44)
  at android.support.test.espresso.core.deps.guava.base.Joiner.appendTo(Joiner.java:111)
  at android.support.test.espresso.core.deps.guava.base.Joiner.appendTo(Joiner.java:152)
  at android.support.test.espresso.core.deps.guava.base.Joiner.appendTo(Joiner.java:140)
  at android.support.test.espresso.util.HumanReadables.getViewHierarchyErrorMessage(HumanReadables.java:76)
  at android.support.test.espresso.NoMatchingViewException.getErrorMessage(NoMatchingViewException.java:87)
  at android.support.test.espresso.NoMatchingViewException.&lt;init&gt;(NoMatchingViewException.java:59)
  at android.support.test.espresso.NoMatchingViewException.&lt;init&gt;(NoMatchingViewException.java:46)
  at android.support.test.espresso.NoMatchingViewException$Builder.build(NoMatchingViewException.java:145)
  at android.support.test.espresso.base.ViewFinderImpl.getView(ViewFinderImpl.java:95)
  at android.support.test.espresso.ViewInteraction$1.run(ViewInteraction.java:120)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
  at java.util.concurrent.FutureTask.run(FutureTask.java:237)
  at android.os.Handler.handleCallback(Handler.java:739)
  at android.os.Handler.dispatchMessage(Handler.java:95)
  at android.os.Looper.loop(Looper.java:145)
  at android.app.ActivityThread.main(ActivityThread.java:5832)
  at java.lang.reflect.Method.invoke(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:372)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
  </code></pre>