java.lang.OutOfMemoryError: pthread_create (1040KB stack) failed: Try again

3,384 views
Skip to first unread message

Madhusudhan reddy Kalathuru

unread,
Sep 30, 2020, 10:58:07 PM9/30/20
to Volley Users
Hi guys,
i am getting below issue ,i dont know where is the mistake 
can anyone help me out please thanks

after 1hr or 2hr or 3hrs....som point of time app is closeing with below error

09-26 16:51:31.370 11631-12074/? E/AndroidRuntime: FATAL EXCEPTION: Timer-0
    Process: com.iramtech.parking.bscl.mpos, PID: 11631
    java.lang.OutOfMemoryError: pthread_create (1040KB stack) failed: Try again
        at java.lang.Thread.nativeCreate(Native Method)
        at java.lang.Thread.start(Thread.java:1063)
        at com.android.volley.RequestQueue.start(RequestQueue.java:134)
        at com.android.volley.toolbox.Volley.newRequestQueue(Volley.java:91)
        at com.android.volley.toolbox.Volley.newRequestQueue(Volley.java:67)
        at com.iramtech.parking.bscl.mpos.Services.HomeService.call_pos_Info_v2(HomeService.java:1208)
        at com.iramtech.parking.bscl.mpos.Services.HomeService.access$400(HomeService.java:72)
        at com.iramtech.parking.bscl.mpos.Services.HomeService$5$1.onSuccess(HomeService.java:435)
        at com.iramtech.parking.bscl.mpos.Authorization.authorise(Authorization.java:110)
        at com.iramtech.parking.bscl.mpos.Services.HomeService$5.run(HomeService.java:421)
        at java.util.Timer$TimerImpl.run(Timer.java:284)

Jeff Davidson

unread,
Oct 1, 2020, 12:50:18 PM10/1/20
to Madhusudhan reddy Kalathuru, Volley Users
The behavior you describe sounds like a memory leak. From a look at your stack trace, it seems like you might be creating and starting a new RequestQueue for every request - this will leak threads every time unless you also stop those RequestQueues after the request completes (which will eventually lead to running out of memory), and is very inefficient even if you do.

You should have a global RequestQueue object (i.e. singleton) that you use for all requests, rather than creating a new one for each network call.

--
You received this message because you are subscribed to the Google Groups "Volley Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to volley-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/volley-users/72a96877-1034-493c-9432-cd4a1b42393an%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages