On Jul 3, 4:50 pm, Drifter <daveh...@yahoo.co.uk> wrote:
> I've finally figured out the discrepancy. Using the following code, I
> ran it through the debugger (in Eclipse, WinXP, emulator) and then ran
> it just through the emulator - I get different results. The debugger
> shows "TestThread Running" while the non-debugger version shows
> "TestThread FinaIizing". I believe the debugger holds a reference to
> the TestThread which prevents it from getting garbage collected.

Yes, I should've spotted that earlier.  The debugger queries all
threads, and references to the Thread objects get passed around.  The
debugger support in Dalvik is somewhat simple-minded, and takes the
approach that anything the debugger might care about cannot be
discarded.  (This isn't necessary, but it does make life a lot
simpler.)  So yes, if you have a debugger attached you're not going to
see Thread objects get collected.

(You also won't see most Exception objects get cleaned up, which is
rather more of a problem.)  See "Known Issues and Limitations" in
dalvik/docs/debugger.html, or
http://android.git.kernel.org/?p=platform/dalvik.git;a=blob_plain;f=docs/debugger.html;hb=HEAD
.  I'll add a note about Thread objects.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to