Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OutOfMemoryError when enqueuing event #521

Closed
tadfisher opened this issue Apr 3, 2017 · 3 comments
Closed

OutOfMemoryError when enqueuing event #521

tadfisher opened this issue Apr 3, 2017 · 3 comments

Comments

@tadfisher
Copy link

Stack traces for similar crashes from two different call sites:

Google Pixel, 7.1.1:

Fatal Exception: java.lang.OutOfMemoryError: Failed to allocate a 1051 byte allocation with 8059912 free bytes and 8MB until OOM; failed due to fragmentation (required continguous free 16384 bytes for a new buffer where largest contiguous free 12288 bytes)
       at java.util.Arrays.copyOf(Arrays.java:3256)
       at java.io.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:178)
       at com.segment.analytics.SegmentIntegration.performEnqueue(SegmentIntegration.java:243)
       at com.segment.analytics.SegmentIntegration$SegmentDispatcherHandler.handleMessage(SegmentIntegration.java:447)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:154)
       at android.os.HandlerThread.run(HandlerThread.java:61)

Samsung Galaxy S6 (Sprint), 6.0.1:

Fatal Exception: java.lang.OutOfMemoryError: Failed to allocate a 2080 byte allocation with 951984 free bytes and 929KB until OOM; failed due to fragmentation (required continguous free 4096 bytes where largest contiguous free 0 bytes)
       at java.io.ByteArrayOutputStream.expand(ByteArrayOutputStream.java:91)
       at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:201)
       at java.io.OutputStreamWriter.flushBytes(OutputStreamWriter.java:170)
       at java.io.OutputStreamWriter.close(OutputStreamWriter.java:143)
       at android.util.JsonWriter.close(JsonWriter.java:393)
       at com.segment.analytics.Cartographer.toJson(Cartographer.java:96)
       at com.segment.analytics.SegmentIntegration.performEnqueue(SegmentIntegration.java:242)
       at com.segment.analytics.SegmentIntegration$SegmentDispatcherHandler.handleMessage(SegmentIntegration.java:447)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:158)
       at android.os.HandlerThread.run(HandlerThread.java:61)
@f2prateek
Copy link
Contributor

We tried to allocate some memory, but couldn't. This might happen if the app is running out of memory. I'm not sure we can do anything here?

@NightlyNexus
Copy link

hm, yeah, I don't see anything special about those implementations.
OOM Errors can be misleading because the crash only happens at the last thing grabbing for memory.
I assume you're using Leak Canary to find anything else that might be leaking in your app?

@tadfisher
Copy link
Author

Yep, probably our fault. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants