致命异常:socket.io中的java.lang.OutOfMemoryError pthread_create

时间:2017-10-27 08:42:04

标签: java android sockets

我在Android应用程序中使用 io.socket.client 。有时我的申请会出现“Fatal Exception: java.lang.OutOfMemoryError: pthread_create (1040KB stack) failed:”错误。我无法重现这个问题。我从Fabric Crash报告

获得了以下日志

这是日志,

       Fatal Exception: java.lang.OutOfMemoryError: pthread_create (1040KB stack) failed: Try again
       at java.lang.Thread.nativeCreate(Thread.java)
       at java.lang.Thread.start(Thread.java:1063)
       at io.socket.engineio.client.transports.PollingXHR$Request.create(PollingXHR.java:232)
       at io.socket.engineio.client.transports.PollingXHR.doPoll(PollingXHR.java:129)
       at io.socket.engineio.client.transports.Polling.poll(Polling.java:95)
       at io.socket.engineio.client.transports.Polling.doOpen(Polling.java:35)
       at io.socket.engineio.client.Transport$1.run(Transport.java:82)
       at io.socket.thread.EventThread.exec(EventThread.java:55)
       at io.socket.engineio.client.Transport.open(Transport.java:77)
       at io.socket.engineio.client.Socket$2.run(Socket.java:248)
       at io.socket.thread.EventThread.exec(EventThread.java:55)
       at io.socket.engineio.client.Socket.open(Socket.java:226)
       at io.socket.client.Manager$1.run(Manager.java:330)
       at io.socket.thread.EventThread.exec(EventThread.java:55)
       at io.socket.client.Manager.open(Manager.java:250)
       at io.socket.client.Manager$11$1.run(Manager.java:560)
       at io.socket.thread.EventThread$2.run(EventThread.java:80)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
       at java.lang.Thread.run(Thread.java:818)

1 个答案:

答案 0 :(得分:-2)

根据Oracle documentation

  

当Java虚拟机不能抛出OutOfMemoryError时   分配一个对象,因为它没有内存,也没有更多的内存   可以由垃圾收集器提供。的OutOfMemoryError   对象可以由虚拟机构造,就像抑制一样   被禁用和/或堆栈跟踪不可写。

应用程序尝试将更多数据添加到堆空间区域,但没有足够的空间。

确保没有内存泄漏。如果没有,那么你必须增加最大堆内存大小。