AnsweredAssumed Answered

Why does Arcgis Runtime for Android download of Preplanned Workflow fail because of unreasonable memory allocations?

Question asked by Crittermap on Apr 10, 2018
Latest reply on May 29, 2018 by Crittermap

I have some ready preplanned map areas that I decided to try with the runtime 100.2.1 before I do this on a larger scale. 

 

I below captured the layer errors below upon failure. 

 

Caused by: java.lang.OutOfMemoryError: Failed to allocate a 710258114 byte allocation with 16777216 free bytes and 40MB until OOM

 

Why in the world would you be trying to allocate 710 Megabytes?

On a MOBILE DEVICE, no less?

 

I can only guess that you are trying to allocate enough memory for the entire file. 

Why would that ever be a good idea?

The destination for the file is a folder on disk. 

BUFFERING is a fairly standard practice for downloading a file from disk. There is no way you need 710 megabytes of memory to download a 710 megabyte file. 

 

You are advertising this preplanned workflow, and I was attracted to all of the benefits. 

Create an offline map—ArcGIS Runtime SDK for Android | ArcGIS for Developers 

But it obviously isn't well coded or well tested. 

 

Please fix it or provide some workaround, so I don't regret the trust I have placed in ESRI for the 10th time. 

 

04-09 21:28:45.907 26473-26473/com.crittermap.arcgissample I/BCNActivity: downloadPreplanned Start: Mon Apr 09 21:28:45 PDT 2018
04-09 21:32:52.395 26473-26473/com.crittermap.arcgissample I/BCNActivity: downloadPreplanned Failed: Mon Apr 09 21:32:52 PDT 2018
04-09 21:33:08.028 26473-26473/? E/BCNActivity: layererrors USA Contour II:
com.esri.arcgisruntime.ArcGISRuntimeException: Check getCause() for further error information.
at com.esri.arcgisruntime.internal.m.h.a(SourceFile:188)
at com.esri.arcgisruntime.internal.m.i.b(SourceFile:6220)
at com.esri.arcgisruntime.tasks.offlinemap.DownloadPreplannedOfflineMapResult.getLayerErrors(SourceFile:91)
at com.crittermap.arcgissample.BCNActivity.lambda$downloadPreplannedArea$2$BCNActivity(BCNActivity.java:369)
at com.crittermap.arcgissample.BCNActivity$$Lambda$1.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
Caused by: java.lang.OutOfMemoryError: Failed to allocate a 710258114 byte allocation with 16777216 free bytes and 40MB until OOM
at com.esri.arcgisruntime.internal.c.p.c.<init>(SourceFile:56)
at com.esri.arcgisruntime.internal.c.p.g.c(SourceFile:133)
at com.esri.arcgisruntime.internal.d.a.a.i.b(SourceFile:194)
at com.esri.arcgisruntime.internal.d.a.a.i.a(SourceFile:61)
at com.esri.arcgisruntime.internal.d.a.a.c.a(SourceFile:463)
at com.esri.arcgisruntime.internal.d.a.a.c.i(SourceFile:425)
at com.esri.arcgisruntime.internal.d.a.a.n.a(SourceFile:80)
at com.esri.arcgisruntime.internal.d.a.a.n.d(SourceFile:32)
at com.esri.arcgisruntime.internal.d.a.a.c$1.call(SourceFile:131)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:762)
04-09 21:33:08.032 26473-26473/? E/BCNActivity: layererrors MultidirectionalHillshadeToSix:
com.esri.arcgisruntime.ArcGISRuntimeException: Not found
at com.esri.arcgisruntime.internal.m.h.a(SourceFile:188)
at com.esri.arcgisruntime.internal.m.i.b(SourceFile:6220)
at com.esri.arcgisruntime.tasks.offlinemap.DownloadPreplannedOfflineMapResult.getLayerErrors(SourceFile:91)
at com.crittermap.arcgissample.BCNActivity.lambda$downloadPreplannedArea$2$BCNActivity(BCNActivity.java:369)
at com.crittermap.arcgissample.BCNActivity$$Lambda$1.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
04-09 21:33:08.035 26473-26473/? E/BCNActivity: layererrors NorthAmericaOSMPackage0325Z:
com.esri.arcgisruntime.ArcGISRuntimeException: Check getCause() for further error information.
at com.esri.arcgisruntime.internal.m.h.a(SourceFile:188)
at com.esri.arcgisruntime.internal.m.i.b(SourceFile:6220)
at com.esri.arcgisruntime.tasks.offlinemap.DownloadPreplannedOfflineMapResult.getLayerErrors(SourceFile:91)
at com.crittermap.arcgissample.BCNActivity.lambda$downloadPreplannedArea$2$BCNActivity(BCNActivity.java:369)
at com.crittermap.arcgissample.BCNActivity$$Lambda$1.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
Caused by: java.lang.OutOfMemoryError: Failed to allocate a 136852558 byte allocation with 16777216 free bytes and 54MB until OOM
at com.esri.arcgisruntime.internal.c.p.c.b(SourceFile:182)
at com.esri.arcgisruntime.internal.c.p.g.c(SourceFile:139)
at com.esri.arcgisruntime.internal.d.a.a.i.b(SourceFile:194)
at com.esri.arcgisruntime.internal.d.a.a.i.a(SourceFile:61)
at com.esri.arcgisruntime.internal.d.a.a.c.a(SourceFile:463)
at com.esri.arcgisruntime.internal.d.a.a.c.i(SourceFile:425)
at com.esri.arcgisruntime.internal.d.a.a.n.a(SourceFile:80)
at com.esri.arcgisruntime.internal.d.a.a.n.d(SourceFile:32)
at com.esri.arcgisruntime.internal.d.a.a.c$1.call(SourceFile:131)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:762)

Outcomes