Reputation: 7652
We're getting an OutOfMemory error inside the Volley library while parsing the network response. This occurs with a large responses on crappy phones. Can this be avoided? Is there any way to tell Volley to parse the response 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 occurs on the Droid X (2.3.4).
Upvotes: 5
Views: 2469
Reputation: 25673
The only time I saw OutOfMemoryError
s in Volley was when I had an OS 2.3 specific memory leak in my code. If you can reliably reproduce this error (e.g. in an automated test with test data) then you should probably raise an issue in the Google Android forum.
In case it might help others, I copied the Volley source into my own Github repository and made a small change so that OutOfMemoryError
s are handled as VolleyError
s. This makes it slightly cleaner to log/handle low memory conditions.
Here's the specific commit:
https://github.com/daj/volley/commit/c9e28fceda34074dda3734561502a20a28167ca9
Upvotes: 3
Reputation: 7652
So, in order to solve this, I switched to using a generic HttpConnection and JsonReader to parse the input stream. Hopefully, somebody will add to Volley and enable it to return a JsonReader ... maybe it will be me ... in my copious spare time ...
Upvotes: 1