Ixam97 / CarStatsViewer

MIT License
98 stars 54 forks source link

Bug: Debug log can become too large #233

Closed Ixam97 closed 2 months ago

Ixam97 commented 5 months ago

The Debug Log does not get deleted automatically. This can cause crashes when the Log becomes to large and cannot be loaded to memory.

20.03.2024 17:42:51.200 E: [NEO] Car Stats Viewer has crashed!
 java.lang.OutOfMemoryError: Failed to allocate a 75497480 byte allocation with 25165824 free bytes and 52MB until OOM, target footprint 238374616, growth limit 268435456
    at java.util.Arrays.copyOf(Arrays.java:3257)
    at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:124)
    at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:448)
    at java.lang.StringBuffer.append(StringBuffer.java:270)
    at java.io.StringWriter.write(StringWriter.java:101)
    at java.io.StringWriter.append(StringWriter.java:143)
    at java.io.StringWriter.append(StringWriter.java:41)
    at com.google.gson.stream.JsonWriter.value(JsonWriter.java:566)
    at com.google.gson.Gson$2.write(Gson.java:395)
    at com.google.gson.Gson$2.write(Gson.java:380)
    at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:126)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:244)
    at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:97)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:61)
    at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:126)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:244)
    at com.google.gson.Gson.toJson(Gson.java:747)
    at com.google.gson.Gson.toJson(Gson.java:726)
    at com.google.gson.Gson.toJson(Gson.java:681)
    at com.google.gson.Gson.toJson(Gson.java:661)
    at com.ixam97.carStatsViewer.ui.activities.DebugActivity$onCreate$5$1.invokeSuspend(DebugActivity.kt:139)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
    Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@9c9168a, Dispatchers.Default]
Ixam97 commented 4 months ago

Addressed with 4d644df.