[mono-android] monodroid-samples/ApiDemo exception at start-up

Jonathan Pryor jpryor at novell.com
Tue Mar 15 20:48:27 EDT 2011


On Mar 15, 2011, at 6:01 PM, Len Charest wrote:
> Thanks for your feedback, Jon. I've attached the relevant part of the log.

Thank you. The actual error is [0]. There is a reference table overflow, which is why everything goes south.

I suspect that you have the Android API Demo sample installed on your emulator. Please remove it.

(A reference table overflow occurs when native code -- including and especially mono code -- generates too many live references to Dalvik-VM allocated objects. On hardware such as the N1, the reference table will hold ~52000 elements, while the emulator holds 512, as is seen in [0]. At the moment, the only real way to avoid this error is to not have so many live references, and the problem with ApiDemo is the
ApiDemo.GetData() method, which loads _every_ Activity with an action of "main" and a category of "sample code" -- 217 in the Android API demo + 24 in the MonoDroid API Demo -- then performs a LINQ OrderBy query on them [1], which pulls in a reference for the ActivityInfo object and the Java.Lang.String that the ActivityInfo references...  When you start with 241 activities and grab something from each one, it doesn't take much to overflow the emulator's local reference table of 512 entries...)

 - Jon

[0] W/dalvikvm(  662): ReferenceTable overflow (max=512)
W/dalvikvm(  662): Last 10 entries in JNI local reference table:
...
E/dalvikvm(  662): VM aborting

[1]  list = list.OrderBy (p => (p.ActivityInfo.NonLocalizedLabel == null ? "" : p.ActivityInfo.NonLocalizedLabel.ToString ()).ToString ()).ToList ();



More information about the Monodroid mailing list