Volleyball OutOfMemoryError

We get an OutOfMemory error inside the Volley library when parsing a network response. This happens with great responses to shitty phones. Can this be avoided? Is there a way to tell Voleil so he can analyze the answers in batches, maybe?

Here's the exception:

07-18 14:33:41.449 6130-6154/com.tinder E/AndroidRuntime: FATAL EXCEPTION: Thread-22 java.lang.OutOfMemoryError at java.lang.String.<init>(String.java:325) at java.lang.String.<init>(String.java:276) at com.android.volley.toolbox.JsonObjectRequest.parseNetworkResponse(JsonObjectRequest.java:66) at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:116) 

This happens on Droid X (2.3.4).

+4
source share
2 answers

So, to solve this problem, I switched to using a common HttpConnection and JsonReader to parse the input stream. I hope someone adds Volley and allows him to return JsonReader ... maybe it will be me ... in my plentiful free time ...

+1
source

The only time I saw OutOfMemoryError in Volley was that there was an OS 2.3 memory leak problem in my code. If you can reliably reproduce this error (for example, in an automatic test with test data), then you probably have a problem on the Google Android forum.

In case this may help others, I copied the Volleyball Source into my own Github repository and made a small change so that OutOfMemoryError handled as VolleyError s. This makes it a little cleaner to write / handle low memory conditions.

Here's the specific commit:
https://github.com/daj/volley/commit/c9e28fceda34074dda3734561502a20a28167ca9

+3
source

Source: https://habr.com/ru/post/1492178/


All Articles