Closed koudle closed 6 years ago
Shouldn't the number of threads be capped at
Are you seeing more than this number created? Are you reusing a single OkHttp instance?
Can you grab a thread dump?
Why do you specifically think the Synchronous Queue is the problem? These queues will generally hold Runnable instances, not create more Threads than it needs.
@yschimke Thank you very much for the prompt reply. You are right,I understand wrong.
The network thread usual is a time-consuming thread ,so when you use SynchronousQueue with ThreadPoolExecutor and submit many threads in a short time,it will new many threads and may cause OOM in Android 7.0 . There are limits on the number of threads on Android 7.0.
[ ] Bug report. java.lang.OutOfMemoryError: pthread_create (1040KB stack) failed: Try again at java.lang.Thread.nativeCreate(Native Method) at com.android.volley.RequestQueue.start(RequestQueue.java:141) at com.android.volley.toolbox.Volley.newRequestQueue(Volley.java:66) at com.android.volley.toolbox.Volley.newRequestQueue(Volley.java:66) at mypackageName.SomeClass.upload(SomeClass) at mypackageName.MyClass$MyThred.run(SomeClass.java:387)
[ ] Feature Request. Don't use SynchronousQueue