Khang-NT / Android-Media-Converter

Android open source media converter build on top of FFmpeg
GNU General Public License v3.0
213 stars 60 forks source link

Large Job's logs cause OutOfMemoryError #59

Closed Khang-NT closed 6 years ago

Khang-NT commented 6 years ago

Stacktrace

Caused by java.lang.OutOfMemoryError: Failed to allocate a 94640388 byte allocation with 16777216 free bytes and 55MB until OOM
       at java.lang.StringFactory.newStringFromBytes(StringFactory.java:79)
       at java.lang.StringFactory.newStringFromBytes(StringFactory.java:207)
       at com.github.khangnt.mcp.ui.jobmanager.JobLogsActivity$reload$1.kotlin.io.FilesKt__FileReadWriteKt.readText(JobLogsActivity.kt:3091)
       at io.reactivex.internal.operators.observable.ObservableFromCallable.subscribeActual(ObservableFromCallable.java:42)
       at io.reactivex.Observable.subscribe(Observable.java:11040)
       at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
       at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:463)
       at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
       at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
       at java.util.concurrent.FutureTask.run(FutureTask.java:237)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
       at java.lang.Thread.run(Thread.java:760)

Fabric tracking issue:

https://fabric.io/khangnt-project/android/apps/com.github.khangnt.mcp/issues/5a92ac828cb3c2fa63ca913c?time=last-thirty-days

Solutions