Android Throwing OutOfMemoryError crash
Issue Description
My app crash every 5 minutes on my android remote device, even if I'm not doing anything on it (live reload or whatever)
Additional Information
- React Native version: 0.32.0
- Platform: Android API 23 or 24 (remote device, tried with both api version)
- Operating System: macOS 10.11.6
- Logs:
08-30 15:25:56.281 31863 4974 W art : Throwing OutOfMemoryError "pthread_create (1040KB stack) failed: Try again"
08-30 15:25:56.286 31863 4974 E AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
08-30 15:25:56.286 31863 4974 E AndroidRuntime: Process: com.bulbthings.app, PID: 31863
08-30 15:25:56.286 31863 4974 E AndroidRuntime: java.lang.OutOfMemoryError: pthread_create (1040KB stack) failed: Try again
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at java.lang.Thread.nativeCreate(Native Method)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at java.lang.Thread.start(Thread.java:730)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:941)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1359)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at okhttp3.ConnectionPool.put(ConnectionPool.java:135)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at okhttp3.OkHttpClient$1.put(OkHttpClient.java:149)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:188)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:129)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:98)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at okhttp3.RealCall.access$100(RealCall.java:33)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at okhttp3.RealCall$AsyncCall.execute(RealCall.java:120)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
08-30 15:25:56.286 31863 4974 E AndroidRuntime: at java.lang.Thread.run(Thread.java:761)
08-30 15:25:56.292 880 3516 W ActivityManager: Force finishing activity com.bulbthings.app/.MainActivity
08-30 15:25:56.310 880 4335 I sensors : activate
08-30 15:25:56.312 880 4335 I nanohub : queueActivate: sensor=1, handle=1, enable=0
08-30 15:25:56.475 880 14298 I OpenGLRenderer: Initialized EGL, version 1.4
08-30 15:25:56.475 880 14298 D OpenGLRenderer: Swap behavior 1
08-30 15:25:56.888 31863 337 W unknown:React: Tried to enqueue runnable on already finished thread: 'native_modules... dropping Runnable.
08-30 15:25:56.889 31863 337 W MessageQueue: Handler (com.facebook.react.bridge.queue.MessageQueueThreadHandler) {44af903} sending message to a Handler on a dead thread
08-30 15:25:56.889 31863 337 W MessageQueue: java.lang.IllegalStateException: Handler (com.facebook.react.bridge.queue.MessageQueueThreadHandler) {44af903} sending message to a Handler on a dead thread
08-30 15:25:56.889 31863 337 W MessageQueue: at android.os.MessageQueue.enqueueMessage(MessageQueue.java:543)
08-30 15:25:56.889 31863 337 W MessageQueue: at android.os.Handler.enqueueMessage(Handler.java:643)
08-30 15:25:56.889 31863 337 W MessageQueue: at android.os.Handler.sendMessageAtTime(Handler.java:612)
08-30 15:25:56.889 31863 337 W MessageQueue: at android.os.Handler.sendMessageDelayed(Handler.java:582)
08-30 15:25:56.889 31863 337 W MessageQueue: at android.os.Handler.post(Handler.java:338)
08-30 15:25:56.889 31863 337 W MessageQueue: at com.facebook.react.bridge.queue.MessageQueueThreadImpl.runOnQueue(MessageQueueThreadImpl.java:61)
08-30 15:25:56.889 31863 337 W MessageQueue: at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
08-30 15:25:56.889 31863 337 W MessageQueue: at android.os.Handler.handleCallback(Handler.java:751)
08-30 15:25:56.889 31863 337 W MessageQueue: at android.os.Handler.dispatchMessage(Handler.java:95)
08-30 15:25:56.889 31863 337 W MessageQueue: at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
08-30 15:25:56.889 31863 337 W MessageQueue: at android.os.Looper.loop(Looper.java:154)
08-30 15:25:56.889 31863 337 W MessageQueue: at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
08-30 15:25:56.889 31863 337 W MessageQueue: at java.lang.Thread.run(Thread.java:761)
08-30 15:25:56.932 880 900 I WindowManager: Destroying surface Surface(name=com.bulbthings.app/com.bulbthings.app.MainActivity) called by com.android.server.wm.WindowStateAnimator.destroySurface:2014 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:881 com.android.server.wm.WindowState.removeLocked:1449 com.android.server.wm.WindowManagerService.removeWindowInnerLocked:2478 com.android.server.wm.AppWindowToken.destroySurfaces:365 com.android.server.wm.WindowStateAnimator.finishExit:565 com.android.server.wm.WindowStateAnimator.stepAnimationLocked:491 com.android.server.wm.WindowAnimator.updateWindowsLocked:303
08-30 15:25:56.981 7622 7662 W OpenGLRenderer: Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer...
08-30 15:26:00.091 31863 31874 W art : Suspending all threads took: 5.472ms
08-30 15:26:01.887 31863 31874 W art : Suspending all threads took: 5.457ms
08-30 15:26:36.303 3355 3355 I DownloadManagerWrapper: onReceive() : Charging = true
08-30 15:27:36.303 3355 3355 I DownloadManagerWrapper: onReceive() : Charging = true
08-30 15:27:36.457 880 893 I ActivityManager: Killing 19125:com.android.chrome/u0a48 (adj 906): empty for 1800s
Adding
<application
android:largeHeap="true"
to the Manifest.xml doesn't help
I get this same crash, closer to only 1 minute after launch (also not doing anything). Seems to only happen when debugging through Chrome.
Same here with a remote Android 5.0.2 while debugging through Chrome.
Hi! Same problem here on Android. I've just started a project with react-native init and begun to follow the Facebook tutorial. When I run the app without debugging, it works fine. If I enable Debug JS remotely, it crashes after 1 minute (doing nothing).
Testing on Samsung Galaxy S5, Android 5.0, react-native-cli 0.2.0, react-native 0.32.1, Windows 7, Chrome 53.
It's a really simple app (I'm starting with RN), with just a couple of text components and an image, and I'm getting exactly the same stacktrace.
Since it's an OutOfMemory problem I've tried to add android:largeHeap="true" to Manifest.xml, but nothing changes. The app reaches around 32Mb and crashes.
I've modified my app, so it loads a component with an image 5000 times. With the debugging disabled, the app allocates up to 70Mb and works fine. I can scroll all over the screen and nothing crashes. So is not a low memory problem on the device.
When I enable the remote debugging, it works for a while, until it tries to allocate more memory and crashes again (around 1-2 minutes). If I launch the app with the debugging already enabled, it starts well (and goes up to the 70Mb fine), but again crashes after a while.
The debugging is constantly consuming memory until it eventually crashes when (I think) it needs to allocate a new chunk of memory.
This is a bug with remote-debugging. For some reason it constantly tries to open a connection to port 8087 and runs out of memory with the sockets.
I'm running in either the same or similar issue. Everything seems to be fine with my app when I don't have remote js debugging on. When I turn it on the app crashes. In my case I can't say when exactly the app crashes. Sometimes it could be 30s. other times 2 mins.
Here is the output from adb logcat
09-25 14:40:49.968 20966 27354 W libc : pthread_create failed: couldn't allocate 1069056-bytes mapped space: Out of memory
09-25 14:40:49.969 20966 27354 W art : Throwing OutOfMemoryError "pthread_create (1040KB stack) failed: Try again"
09-25 14:40:49.974 20966 27354 E AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
09-25 14:40:49.974 20966 27354 E AndroidRuntime: Process: com.compojoom.android.react.farmerjoe, PID: 20966
09-25 14:40:49.974 20966 27354 E AndroidRuntime: java.lang.OutOfMemoryError: pthread_create (1040KB stack) failed: Try again
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at java.lang.Thread.nativeCreate(Native Method)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at java.lang.Thread.start(Thread.java:1063)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:921)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1339)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at okhttp3.ConnectionPool.put(ConnectionPool.java:135)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at okhttp3.OkHttpClient$1.put(OkHttpClient.java:149)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:188)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:129)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:98)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at okhttp3.RealCall.access$100(RealCall.java:33)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at okhttp3.RealCall$AsyncCall.execute(RealCall.java:120)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
09-25 14:40:49.974 20966 27354 E AndroidRuntime: at java.lang.Thread.run(Thread.java:818)
09-25 14:40:49.981 898 1872 W ActivityManager: Force finishing activity com.compojoom.android.react.farmerjoe/.MainActivity
09-25 14:40:49.992 898 27355 W AES : Exception Log handling...
09-25 14:40:50.027 898 909 E Sensors : handleToDriver handle(0)
09-25 14:40:50.054 20966 20981 W libc : pthread_create failed: couldn't allocate 1069056-bytes mapped space: Out of memory
09-25 14:40:50.054 20966 20981 W art : Throwing OutOfMemoryError "pthread_create (1040KB stack) failed: Try again"
09-25 14:40:50.054 20966 20981 W libc : pthread_create failed: couldn't allocate 1069056-bytes mapped space: Out of memory
09-25 14:40:50.054 20966 20981 W art : Throwing OutOfMemoryError "pthread_create (1040KB stack) failed: Try again"
09-25 14:40:50.150 898 13886 W libEGL : [ANDROID_RECORDABLE] format: 1
09-25 14:40:50.234 1430 1844 E MPlugin : Unsupported class: com.mediatek.common.telephony.IOnlyOwnerSimSupport
09-25 14:40:50.274 898 957 E WifiConfigStore: updateConfiguration freq=2457 BSSID=bc:ee:7b:8e:a6:70 RSSI=-66 "GD"WPA_PSK
09-25 14:40:50.391 898 898 E WifiTrafficPoller: TRAFFIC_STATS_POLL true Token 11 num clients 8
09-25 14:40:50.392 898 898 E WifiTrafficPoller: packet count Tx=1712 Rx=4782
09-25 14:40:50.418 898 948 W InputDispatcher: channel '546835f com.compojoom.android.react.farmerjoe/com.compojoom.android.react.farmerjoe.MainActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9
09-25 14:40:50.418 898 948 E InputDispatcher: channel '546835f com.compojoom.android.react.farmerjoe/com.compojoom.android.react.farmerjoe.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
09-25 14:40:50.421 898 2784 W InputDispatcher: Attempted to unregister already unregistered input channel '546835f com.compojoom.android.react.farmerjoe/com.compojoom.android.react.farmerjoe.MainActivity (server)'
09-25 14:40:50.472 1518 1782 W libEGL : [ANDROID_RECORDABLE] format: 1
09-25 14:40:50.477 898 1016 W InputMethodManagerService: Got RemoteException sending setActive(false) notification to pid 20966 uid 10106
09-25 14:40:50.565 898 918 W AppOps : Finishing op nesting under-run: uid 1000 pkg android code 24 time=0 duration=0 nesting=0
09-25 14:40:50.693 898 918 W WindowAnimator: Failed to dispatch window animation state change.
09-25 14:40:50.693 898 918 W WindowAnimator: android.os.DeadObjectException
09-25 14:40:50.693 898 918 W WindowAnimator: at android.os.BinderProxy.transactNative(Native Method)
09-25 14:40:50.693 898 918 W WindowAnimator: at android.os.BinderProxy.transact(Binder.java:511)
09-25 14:40:50.693 898 918 W WindowAnimator: at android.view.IWindow$Stub$Proxy.onAnimationStopped(IWindow.java:548)
09-25 14:40:50.693 898 918 W WindowAnimator: at com.android.server.wm.WindowAnimator.updateWindowsLocked(WindowAnimator.java:315)
09-25 14:40:50.693 898 918 W WindowAnimator: at com.android.server.wm.WindowAnimator.animateLocked(WindowAnimator.java:736)
09-25 14:40:50.693 898 918 W WindowAnimator: at com.android.server.wm.WindowAnimator.-wrap0(WindowAnimator.java)
09-25 14:40:50.693 898 918 W WindowAnimator: at com.android.server.wm.WindowAnimator$1.doFrame(WindowAnimator.java:137)
09-25 14:40:50.693 898 918 W WindowAnimator: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:892)
09-25 14:40:50.693 898 918 W WindowAnimator: at android.view.Choreographer.doCallbacks(Choreographer.java:696)
09-25 14:40:50.693 898 918 W WindowAnimator: at android.view.Choreographer.doFrame(Choreographer.java:628)
09-25 14:40:50.693 898 918 W WindowAnimator: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:880)
09-25 14:40:50.693 898 918 W WindowAnimator: at android.os.Handler.handleCallback(Handler.java:815)
09-25 14:40:50.693 898 918 W WindowAnimator: at android.os.Handler.dispatchMessage(Handler.java:104)
09-25 14:40:50.693 898 918 W WindowAnimator: at android.os.Looper.loop(Looper.java:207)
09-25 14:40:50.693 898 918 W WindowAnimator: at android.os.HandlerThread.run(HandlerThread.java:61)
09-25 14:40:50.693 898 918 W WindowAnimator: at com.android.server.ServiceThread.run(ServiceThread.java:46)
09-25 14:40:50.695 898 918 W WindowAnimator: Failed to dispatch window animation state change.
09-25 14:40:50.695 898 918 W WindowAnimator: android.os.DeadObjectException
09-25 14:40:50.695 898 918 W WindowAnimator: at android.os.BinderProxy.transactNative(Native Method)
09-25 14:40:50.695 898 918 W WindowAnimator: at android.os.BinderProxy.transact(Binder.java:511)
09-25 14:40:50.695 898 918 W WindowAnimator: at android.view.IWindow$Stub$Proxy.onAnimationStopped(IWindow.java:548)
09-25 14:40:50.695 898 918 W WindowAnimator: at com.android.server.wm.WindowAnimator.updateWindowsLocked(WindowAnimator.java:315)
09-25 14:40:50.695 898 918 W WindowAnimator: at com.android.server.wm.WindowAnimator.animateLocked(WindowAnimator.java:736)
09-25 14:40:50.695 898 918 W WindowAnimator: at com.android.server.wm.WindowAnimator.-wrap0(WindowAnimator.java)
09-25 14:40:50.695 898 918 W WindowAnimator: at com.android.server.wm.WindowAnimator$1.doFrame(WindowAnimator.java:137)
09-25 14:40:50.695 898 918 W WindowAnimator: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:892)
09-25 14:40:50.695 898 918 W WindowAnimator: at android.view.Choreographer.doCallbacks(Choreographer.java:696)
09-25 14:40:50.695 898 918 W WindowAnimator: at android.view.Choreographer.doFrame(Choreographer.java:628)
09-25 14:40:50.695 898 918 W WindowAnimator: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:880)
09-25 14:40:50.695 898 918 W WindowAnimator: at android.os.Handler.handleCallback(Handler.java:815)
09-25 14:40:50.695 898 918 W WindowAnimator: at android.os.Handler.dispatchMessage(Handler.java:104)
09-25 14:40:50.695 898 918 W WindowAnimator: at android.os.Looper.loop(Looper.java:207)
09-25 14:40:50.695 898 918 W WindowAnimator: at android.os.HandlerThread.run(HandlerThread.java:61)
09-25 14:40:50.695 898 918 W WindowAnimator: at com.android.server.ServiceThread.run(ServiceThread.java:46)
09-25 14:40:50.705 898 918 E MultiWindowProxy: getServiceInstance failed!
09-25 14:40:50.711 238 238 W SurfaceFlinger: couldn't log to binary event log: overflow.
09-25 14:40:51.015 1518 1782 W OpenGLRenderer: Incorrectly called buildLayer on View: ShortcutAndWidgetContainer @ab52762, destroying layer...
09-25 14:40:51.015 1518 1782 W OpenGLRenderer: Incorrectly called buildLayer on View: ShortcutAndWidgetContainer @b4fa880, destroying layer...
Please analyze your memory, here's a guide on how to do that: https://developer.android.com/studio/profile/am-memory.html
https://developer.android.com/studio/profile/am-hprof.html
@fab1an - the crazy thing is that since I launched the memory monitor in android studio yesterday evening the app hasn't crashed once... 9h without a crash... Event after closing Android Studio the app still works without any issues.
No clue what happened here. Before that it was crashing like every minute...
@compojoom Can you still try to look at the Heap with hprof and check it out? I know it takes some getting used to, but it's a vital skill for Android/Java and you might learn what's going on.
Is there an unusual number of Activities, Applications, Images or else not being collected. How long is the finalizer queue and so on.
@fab1an - well I can generate a heap and look at it. But the thing is - if the app isn't crashing anymore how is the heap going to help us?
@compojoom Maybe you find a memory-leak that causes the crash when it get's too large.
If you have an OutOfMemoryError in a Java app the first thing you should do is doing a heap-dump to check where all the memory has gone to.
@compojoom Check out: https://github.com/facebook/react-native/issues/8677#issuecomment-249563197
@fab1an - can you explain something to me. I thought that the heap-dump would work more like the xdebug profiler. You have it running all the time and when you hit the error you have the situation recorded.
The heap-dump seems to be a snapshot of the memory for a second. How is this going to help with debugging the issue if the app crashes 10 mins after the heap-dump was taken? I thought that maybe if I run the memory allocation I'll know more, but when the app crashes the memory monitor stops and the record allocation doesn't complete.
How am I supposed to take a heap-dump that would actually help with debugging this?
@compojoom You could check out the heap-dump for unusual memory usage. If you have 3 activities, 10 views and 200 Bitmaps in the dump, while you app actually has 1 Activity, 5 views and 10 bitmaps, then you know there's something going wrong.
Here is the heap-dump if you are interested. Around 10s later the app crashed. https://1drv.ms/u/s!ArR5BL6RniuIhZIYRmI_wI1DvC3K2w
For me this is currently Chinese. I'll have to read a lot in order to understand it.
I've run the analizer tasks and it doesn't find any leaked activities, but some duplicated strings ( no idea what that is). The interseting part is that when I click on the STring (jhava.lang) class name I see a lot of instances that have "http://localhost:8097" Why 8097? The debugger should be running on 8081, no?
Sorry, I don't have time to do that work for you.
no problem @fab1an - I didn't mean it to sound that way. I'll try to figure that out.
As far port 8097 is concerned. It seems that it is related to react devtools.
I'll write my findings here.
I still can't figure out why the app crashes (can't find anything out of the ordinary in the heap), but I found the following. When I restart the device - no app crashes. When I disconnect the phone from the PC and later connect it the app starts to crash. When I reboot the phone - everything is again ok.
Any news on this?
Btw, we encounter this issue since RN 0.34 and above. With an app that is still based on RN 0.26 the issue never happens while debugging with chrome, but apps with RN 0.34 and RN 0.38 have this issue as the others describe above
Having this issue too.
Fatal Exception: java.lang.OutOfMemoryError: pthread_create (stack size 16384 bytes) failed: Try again
at java.lang.VMThread.create(VMThread.java)
at java.lang.Thread.start(Thread.java:1029)
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:920)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1338)
at okhttp3.ConnectionPool.put(ConnectionPool.java:135)
at okhttp3.OkHttpClient$1.put(OkHttpClient.java:149)
at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:188)
at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:129)
at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:98)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170)
at okhttp3.RealCall.access$100(RealCall.java:33)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:120)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
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:841)
RN: 0.35.0
On device with remote debug Chrome Devtools open. Was there any fixes yet? Or is this corrected in future versions?