Out of Memory crash on JsonAdapter when parsing very large json array #3790
Replies: 2 comments 1 reply
-
Same issue for me. Server just give some big JSON file. Need something like Sax Parsser or some adapter to convert stream of bytes to stream of objects Fatal Exception: java.lang.OutOfMemoryError
|
Beta Was this translation helpful? Give feedback.
-
There's nothing Retrofit can do to avoid OOMs–these are occurring because your heap is full and is likely fragmented. It's possible there's things like memory leaks and other large allocations occupying the heap and preventing new objects to be created. The stack trace of an OOM is almost always never the underlying cause. It's merely the straw the broke the camels back. You can use heap analysis tools and leak analysis tools to try and identify where your memory is going, but Retrofit was just the unlucky code that happened to be running when you ran out of memory. Any allocation could have failed at any point in the app. |
Beta Was this translation helpful? Give feedback.
-
Hi! I would like to request if there is a solution for an out of memory issue when parsing a very large json array.
This is the part where it crashes:
Appreciate your help. Thanks! Currently using the 2.6.0 version of retrofit.
Or is there a better way to handle large amount of json using
MoshiResponseBodyConverter.convert
? ThanksBeta Was this translation helpful? Give feedback.
All reactions