MrZhousf / OkHttp3

基于OkHttp3封装的网络请求库——致力于最简洁、功能最全、可灵活扩展的网络操作API
397 stars 131 forks source link

在依次发送多个请求后,出现java.lang.OutOfMemoryError错误 #24

Open lyx383982759 opened 6 years ago

lyx383982759 commented 6 years ago

01-12 16:37:23.970 6489-7775/line.red.ths.com.cn.redline E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher Process: line.red.ths.com.cn.redline, PID: 6489 java.lang.OutOfMemoryError: pthread_create (1040KB stack) failed: Out of memory at java.lang.Thread.nativeCreate(Native Method) at java.lang.Thread.start(Thread.java:1076) at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:920) at java.util.concurrent.ThreadPoolExecutor.processWorkerExit(ThreadPoolExecutor.java:988) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:831)

MrZhousf commented 6 years ago

依赖的是最新的版本吗?

lyx383982759 commented 6 years ago

是最新版本的。我也尝试换了之前的版本也都是会报错,使用的是OkHttpUtil.getDefault().doPostAsync这个放啊请求的,在依次发送多个请求后程序不会立即报错,而是过了几秒钟或者几十秒中后才报的错误,APP也就退出了。

MrZhousf commented 6 years ago

可以发下请求代码片段吗,如果可以发demo那就更好了。

yangjieK commented 6 years ago

新版本可以解决, 多次new OkhttpClient 实例.