I have Xamarin.Android app using Google Maps in various scenarios - user can for example open details of various paths displayed as polylines on map. From time to time I get this error:
E/dalvikvm(13160): JNI ERROR (app bug): global reference table overflow (max=51200)
W/dalvikvm(13160): JNI global reference table (0x848a2008) dump:
W/dalvikvm(13160): Last 10 entries (of 51200):
W/dalvikvm(13160): 51199: 0x45a244d0 com.google.android.gms.maps.Projection
W/dalvikvm(13160): 51198: 0x45e5e9d8 com.google.android.gms.maps.model.LatLng
W/dalvikvm(13160): 51197: 0x45e5ea18 com.google.android.gms.maps.model.LatLng
W/dalvikvm(13160): 51196: 0x45e5ea58 com.google.android.gms.maps.model.LatLngBounds
W/dalvikvm(13160): 51195: 0x45e5ead8 com.google.android.gms.maps.model.VisibleRegion
W/dalvikvm(13160): 51194: 0x45f9bc28 com.google.android.gms.maps.Projection
W/dalvikvm(13160): 51193: 0x43975690 com.google.android.gms.maps.model.LatLng
W/dalvikvm(13160): 51192: 0x43975788 com.google.android.gms.maps.model.LatLng
W/dalvikvm(13160): 51191: 0x439757a8 com.google.android.gms.maps.model.LatLngBounds
W/dalvikvm(13160): 51190: 0x43975810 com.google.android.gms.maps.model.VisibleRegion
Followed by summary of global reference table. Biggest items are always :
1668 of com.google.android.gms.maps.model.LatLng (1668 unique instances)
...
378 of com.google.android.gms.maps.model.Polyline (378 unique instances)
...
44439 of com.google.android.gms.clearcut.a.h (44439 unique instances)
I know that Xamarin use Managed Callable Wrappers for LatLng, Polyline and all this stuff, so I already added disposing logic around these. But what about the real killer:
com.google.android.gms.clearcut.a.h
I have no idea what this is (google is not helping), how to dispose of it and thus prevent gref table overflow from killing my app. Any ideas?