osmfocus icon indicating copy to clipboard operation
osmfocus copied to clipboard

OSM API JSON parse OutOfMemoryError

Open ubipo opened this issue 3 years ago • 0 comments

Out of memory while parsing OSM API json.

Possible solutions:

  • Stream json values instead of parsing all at once
  • Change download window depending on available memory

Stackrace:

java.lang.OutOfMemoryError: Failed to allocate a 17159624 byte allocation with 8388608 free bytes and 8MB until OOM, max allowed footprint 200681528, growth limit 201326592
	at java.lang.StringFactory.newStringFromBytes(StringFactory.java:178)
	at java.lang.StringFactory.newStringFromBytes(StringFactory.java:209)
	at com.github.kittinunf.fuel.core.deserializers.StringDeserializer.deserialize(StringDeserializer.kt:3)
	at com.github.kittinunf.fuel.core.DeserializableKt.awaitResponseResult(Deserializable.kt:13)
	at net.pfiers.osmfocus.service.osmapi.ApiKt$apiReq$$inlined$awaitStringResponseResult$default$1.invokeSuspend(Coroutines.kt:1)
[...]

ubipo avatar Jun 26 '22 17:06 ubipo