Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FATAL EXCEPTION: java.lang.OutOfMemoryError: EnsureLocalCapacity (FileInputStream.open0, android.graphics.Typeface.getFullFlipFont)

After upgrading BuildTools from 23 to 27 I faced issue with crash.

I've checked RAM usage in profiler - there's no anomaly there. App crashes sometimes in background, sometimes in foreground, in different activities (crash is completely nondeterministic), it doesn't seem to depend on memory usage (was able to crash with 350mb usage like also with 200mb)

I also installed 'square/leakcanary' to find any memoryleaks, but nothing's there...

Seems to be a problem with loading native typeface. I don't use custom font in this application. I managed to crash app on Samsung S9 and Samsung S5. Any ideas? :(

Thanks for any help!

Stacktrace:

2018-10-05 08:09:04.740 20542-20542/pl.chillout.debug E/AndroidRuntime: FATAL EXCEPTION: main
Process: pl.chillout.debug, PID: 20542
java.lang.OutOfMemoryError: EnsureLocalCapacity
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:200)
    at java.io.FileInputStream.<init>(FileInputStream.java:150)
    at android.graphics.Typeface.getFullFlipFont(Typeface.java:1275)
    at android.graphics.Typeface.getFontPathFlipFont(Typeface.java:1220)
    at android.graphics.Typeface.SetFlipFonts(Typeface.java:1413)
    at android.graphics.Typeface.SetAppTypeFace(Typeface.java:1547)
    at android.app.Activity.onCreate(Activity.java:1020)
    at android.support.v4.app.SupportActivity.onCreate(SupportActivity.java:66)
    at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:321)
    at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:84)
    at pl.chillout.redesign.activity.BaseDrawerActivity.onCreate(BaseDrawerActivity.java:45)
    at pl.chillout.redesign.activity.ChilloutActivity.onCreate(ChilloutActivity.java:115)
    at android.app.Activity.performCreate(Activity.java:7174)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2908)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3030)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
    at android.os.Handler.dispatchMessage(Handler.java:105)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6938)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
like image 648
Cililing Avatar asked Oct 05 '18 06:10

Cililing


1 Answers

Actually, I finally managed to fully "fix" this crash (as I mentioned in question comment section problem wasn't applicable to release builds) by upgrading BuildTools from version 27 to 28.

like image 99
Cililing Avatar answered Oct 14 '22 22:10

Cililing