sky9971
sky9971

Reputation: 3

Clear Memory occupied by volley request queue

I have an android application in which I need multiple volley request queue's to be maintained for different iot devices. My app needs to communicate with each iot device on separate request queue for faster response. But because I have new request queue being created for each new iot device object, my app is going out of memory.

 pthread_create failed: couldn't allocate 1069056-bytes mapped space: Out of memory

I want to clear the memory occupied by previous request queue.. Is it possible by any means??

I also tried to clear the memory occupied by calling

requestqueue.stop()

but it did not help, I would still get the same error and app would crash.

Upvotes: 0

Views: 920

Answers (4)

Archu Mohan
Archu Mohan

Reputation: 219

  RequestQueue que= new RequestQueue(new NoCache(),new BasicNetwork(new HurlStack()));

Just use this, hope this will help u...:)

Upvotes: 0

UVM
UVM

Reputation: 9914

The most preferred use case is as follows:

The more common use case is to create the RequestQueue as a singleton to keep it running for the lifetime of your app, as described in the next section

You can check android developer site for more information.

Set up RequestQueue

Upvotes: 0

Chetan Patil
Chetan Patil

Reputation: 622

One thing you can try is clear the cache object of previously created volley request queue using below code

AppController.getInstance().getRequestQueue().getCache().clear();

Upvotes: 0

Archu Mohan
Archu Mohan

Reputation: 219

just use all the requests inside your AsyncTask ,, maybe it will help you

Upvotes: 0

Related Questions