Select to view content in your preferred language

GeometryEngine.union seemingly causing weak global reference table overflow

507
2
Jump to solution
04-05-2023 12:19 PM
jasonhartley67
New Contributor

I have an app that stays running in the foreground indefinitely. (It is an app running on a dedicated Android device that serves no other purpose than to run this app.) The app takes a small list of Geometries (often only 2-4), performs a GeometryEngine.union() operation on them, then calls setViewpointGeometryAsync on the MapView. But after about ~8 hours of running, the app crashes with:

A  Abort message: 'JNI ERROR (app bug): weak global reference table overflow (max=51200)weak global reference table dump:
    Last 10 entries (of 51200):
      51199: 0x13c7b8c0 com.esri.arcgisruntime.internal.jni.CoreTask
      51198: 0x13c76670 com.esri.arcgisruntime.internal.jni.CoreTask
      51197: 0x13c71420 com.esri.arcgisruntime.internal.jni.CoreTask
      51196: 0x13c695d0 com.esri.arcgisruntime.internal.jni.CoreTask
      51195: 0x13c5f680 com.esri.arcgisruntime.internal.jni.CoreTask
      51194: 0x13c59eb0 com.esri.arcgisruntime.internal.jni.CoreTask
      51193: 0x13c51560 com.esri.arcgisruntime.internal.jni.CoreTask
      51192: 0x13c4c310 com.esri.arcgisruntime.internal.jni.CoreTask
      51191: 0x13c444c0 com.esri.arcgisruntime.internal.jni.CoreTask
      51190: 0x13bb9fd0 com.esri.arcgisruntime.internal.jni.CoreTask
    Summary:
      51050 of com.esri.arcgisruntime.internal.jni.CoreTask (51050 unique instances)
         57 of com.esri.arcgisruntime.internal.jni.j (19 unique instances)
         28 of com.esri.arcgisruntime.internal.jni.CoreVector (28 unique instances)
         22 of java.lang.DexCache (22 unique instances)
         10 of com.esri.arcgisruntime.internal.jni.CoreMapView (1 unique instances)
          8 of dalvik.system.PathClassLoader (5 unique instances)
          4 of com.esri.arcgisruntime.internal.jni.CoreArcGISTiledLayer (1 unique instances)
          4 of com.esri.arcgisruntime.internal.jni.CoreMap (1 unique instances)
          3 of com.esri.arcgisruntime.internal.jni.CoreBasemap (1 unique instances)

Is there something I'm doing wrong that is not allowing these weak references to be released?

Is this a bug in the ArcGIS library?

0 Kudos
1 Solution

Accepted Solutions
GuntherHeppner
Esri Contributor

Judging from the stack trace, the weak global reference table overflow is most likely not caused by GeometryEngine.union(). There seem to be a large number of CoreTask objects not being garbage collected, which indicates that your app makes a lot of async calls which return an object of ListenableFuture, for example FeatureTable.queryFeaturesAsync. Is your app making those type of async calls frequently and is it possible that the returned ListenableFuture objects don't get garbage collected because they are held on to by some strong references in the app code?

View solution in original post

2 Replies
GuntherHeppner
Esri Contributor

Judging from the stack trace, the weak global reference table overflow is most likely not caused by GeometryEngine.union(). There seem to be a large number of CoreTask objects not being garbage collected, which indicates that your app makes a lot of async calls which return an object of ListenableFuture, for example FeatureTable.queryFeaturesAsync. Is your app making those type of async calls frequently and is it possible that the returned ListenableFuture objects don't get garbage collected because they are held on to by some strong references in the app code?

jasonhartley67
New Contributor

Yep! That was it! The line of code right after the call to GeometryEngine.union() involved the creation of a ListenableFuture (to wait for a map rotation to complete before calling setViewpointGeometryAsync), which once removed, removed the weak global references overflow exception. Thank you!

0 Kudos