0

I am using Volley for my networking library and I am getting an out of memory error. It only happened to one of our users once, but I would like to find out, if possible how I can fix this.

The stacktrace is tiny and very, not helpful at all:

Fatal Exception: java.lang.OutOfMemoryError
   at java.io.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:122)
   at com.android.volley.toolbox.BasicNetwork.entityToBytes(BasicNetwork.java:241)
   at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:123)
   at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:112)

That is the whole stacktrace?

Any ideas?

Stillie
  • 2,647
  • 6
  • 28
  • 50
  • how large is the content, retrieved by volley? Looks like the device's memory was to small to handle that size of content. Also what is the device model? – Vladyslav Matviienko Nov 30 '16 at 06:43
  • see its difficult to say where this call was made, we have about 68 different webservice calls in this app and it technically could be any one of these? – Stillie Nov 30 '16 at 06:44
  • Out of memory is for the entire app. The problem may be the immediate request, but frequently its somewhere totally different. There's no way to debug from the given information. Try to figure out what request it is, how big the requested data is that caused it, and see if its unreasonbable. If not, look at heap dumps to see total memory usage and look for leaks. – Gabe Sechan Nov 30 '16 at 06:50

1 Answers1

0

how to correct this error: java.lang.OutOfMemoryError: Check this

Most of times this happens due to large bitmap cross the limit of VM heap, so you need to scale down your image or to lower the quality of you image.

Community
  • 1
  • 1
Ravish Sharma
  • 207
  • 2
  • 14