Out of Memory Exception
Closed this issue · 5 comments
I'm getting an out of memory exception albeit very rarely from UA:
Package: com.project.app
Version Code: 43
Version Name: 1.3.2
Android: 5.0.1
Android Build: LRX22C.L720TVPUCOK3
Manufacturer: samsung
Model: SPH-L720T
Thread: main-1
Start Date: Wed Nov 23 19:53:22 EST 2016
Date: Wed Nov 23 19:57:41 EST 2016
java.lang.OutOfMemoryError: pthread_create (1040KB stack) failed: Try again
at java.lang.Thread.nativeCreate(Native Method)
at java.lang.Thread.start(Thread.java:1063)
at android.app.IntentService.onCreate(IntentService.java:108)
at com.urbanairship.analytics.EventService.onCreate(EventService.java:125)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3157)
at android.app.ActivityThread.access$1900(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1532)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5951)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
@owlstack Out of memory issues are tricky to track down. The component that throws the out of memory exception are rarely the culprit, its more likely that they are just the last piece of code that is running when the app runs out of memory.
I would recommend doing general memory debugging for your app. Also double check that you are following best practices in terms of memory caching, i.e make sure its based on the percent of memory of the device instead of a static value.
@rlepinski I will admit I am using Urban Airship 2.0.5 Xamarin Component, so I'm not sure if that's related to the memory leak or not.
What are best practices involving memory caching? Is it something I have to handle on my end? What's the best way to do memory debugging within my app? Thanks!
@owlstack Not sure what tools xamarin provide, but I am pretty sure these apply:
- https://developer.android.com/studio/profile/investigate-ram.html
- https://developer.android.com/studio/profile/am-memory.html
For memory management, take a look at these:
https://developer.android.com/topic/performance/memory.html
https://developer.android.com/training/displaying-bitmaps/cache-bitmap.html
Thank you so much for the resources!
Good luck. Please reopen the issue if you find that the culprit is actually us.