Hi guys,
I just ported my app to Volley and I am having a hard time with Threads. I use one Singleton that delivers the same RequestQueue to the whole application so I just cancel the request
in the Fragments when the Fragment get's destroyed.
My problem is, after a Request is finished, the threads associated to it seems to remain in the "Wait" status forever, so eventually the number of threads in Wait gets to big and I end up getting:
java.lang.OutOfMemoryError: pthread_create (stack size 16384 bytes) failed: Try again
I use the default RequestQueue by calling Volley.newRequestQueue(), and this I how I add the request:
public void addToQueue(GsonRequest request) {
if (request != null) {
request.setTag(this);
if (mRequestQueue == null)
mRequestQueue = VolleyS.getInstance(mContext).getRequestQueue(); // This returns always the same Queue created with Volley.newRequestQueue(context)
mRequestQueue.add(request);
}
}
Does anyone have an idea of what am I doing wrong?
Thank you very much!