title: Debugging low memory crash (threads related?)
body: <p>I'm trying to debug a mysterious crash of my Android application that seems to occur in the low memory conditions. The sources of the app in question are available from <a href="https://bitbucket.org/stativ/chmupocasi" rel="nofollow">https://bitbucket.org/stativ/chmupocasi</a>. The application's package is <code>cz.jirkovsky.lukas.chmupocasi</code></p>
  
  <p>What happens is that when the phone starts to run low on memory and I try to reopen the application from the list of recent apps (the one that shows after a long press of the <em>Home</em> button), the application crashes.</p>
  
  <p>I've tried to debug the application using the Android Studio, but the application always crashes before hitting any of the breakpoints in the main Activity's onCreate() and onStart() making it impossible to debug. What is worse that even the logcat doesn't contain any information, the only related line shown when the app crashes is:</p>
  
  <pre><code>I/ActivityManager(  428): Displayed cz.jirkovsky.lukas.chmupocasi/.MainActivity: +1s45ms (total +23m23s835ms)
  </code></pre>
  
  <p>The full logcat is available at <a href="http://pastebin.com/TtSuqxCW" rel="nofollow">http://pastebin.com/TtSuqxCW</a>, in case I'm missing something.</p>
  
  <p>Finally, I've tried attaching the debugger to the application after it crashes, when the Android's dialog "Unfortunately the application has stopped" is shown. I don't see any of my code being run in any thread. Here is what the "Export Threads" contain:</p>
  
  <pre><code>&lt;1&gt; main@830017304224, prio=5, in group 'main', status: 'RUNNING'
    at android.os.BinderProxy.transact(Binder.java:-1)
    at android.app.ActivityManagerProxy.handleApplicationCrash(ActivityManagerNative.java:3147)
    at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:76)
    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
    at dalvik.system.NativeStart.main(NativeStart.java:-1)
  
  &lt;10&gt; Binder_2@830026133152, prio=5, in group 'main', status: 'RUNNING'
    at dalvik.system.NativeStart.run(NativeStart.java:-1)
  
  &lt;9&gt; Binder_1@830026131496, prio=5, in group 'main', status: 'RUNNING'
    at dalvik.system.NativeStart.run(NativeStart.java:-1)
  
  &lt;8&gt; FinalizerWatchdogDaemon@830026116408 daemon, prio=5, in group 'system', status: 'WAIT'
    at java.lang.Object.wait(Object.java:-1)
    at java.lang.Object.wait(Object.java:364)
    at java.lang.Daemons$FinalizerWatchdogDaemon.run(Daemons.java:214)
    at java.lang.Thread.run(Thread.java:856)
  
  &lt;7&gt; FinalizerDaemon@830026115976 daemon, prio=5, in group 'system', status: 'WAIT'
    at java.lang.Object.wait(Object.java:-1)
    at java.lang.Object.wait(Object.java:401)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:102)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:73)
    at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:169)
    at java.lang.Thread.run(Thread.java:856)
  
  &lt;6&gt; ReferenceQueueDaemon@830026115560 daemon, prio=5, in group 'system', status: 'WAIT'
    at java.lang.Object.wait(Object.java:-1)
    at java.lang.Object.wait(Object.java:364)
    at java.lang.Daemons$ReferenceQueueDaemon.run(Daemons.java:129)
    at java.lang.Thread.run(Thread.java:856)
  
  &lt;5&gt; Compiler@830026115320 daemon, prio=5, in group 'system', status: 'WAIT'
    at dalvik.system.NativeStart.run(NativeStart.java:-1)
  
  &lt;3&gt; Signal Catcher@830026114840 daemon, prio=5, in group 'system', status: 'WAIT'
    at dalvik.system.NativeStart.run(NativeStart.java:-1)
  
  &lt;2&gt; GC@830026114616 daemon, prio=5, in group 'system', status: 'WAIT'
    at dalvik.system.NativeStart.run(NativeStart.java:-1)
  </code></pre>
  
  <p>If I try to examine the main thread, I can see that there is an unhandled exception somewhere in the ThreadGroup:</p>
  
  <pre><code> No such instance field: 'nthreads'
  </code></pre>
  
  <p>Any ideas how to debug such crash or how to get more information about it?</p>