Added memory breadcrumbs

pull/160/head
M66B 5 years ago
parent 71cdeadcde
commit 02435d79c0

@ -31,7 +31,9 @@ import android.webkit.CookieManager;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import java.util.HashMap;
import java.util.Locale; import java.util.Locale;
import java.util.Map;
public class ApplicationEx extends Application { public class ApplicationEx extends Application {
private Thread.UncaughtExceptionHandler prev = null; private Thread.UncaughtExceptionHandler prev = null;
@ -90,12 +92,19 @@ public class ApplicationEx extends Application {
@Override @Override
public void onTrimMemory(int level) { public void onTrimMemory(int level) {
Log.logMemory(this, "Trim memory level=" + level); Log.logMemory(this, "Trim memory level=" + level);
Map<String, String> crumb = new HashMap<>();
crumb.put("level", Integer.toString(level));
crumb.put("free", Integer.toString(Log.getFreeMemMb()));
Log.breadcrumb("trim", crumb);
super.onTrimMemory(level); super.onTrimMemory(level);
} }
@Override @Override
public void onLowMemory() { public void onLowMemory() {
Log.logMemory(this, "Low memory"); Log.logMemory(this, "Low memory");
Map<String, String> crumb = new HashMap<>();
crumb.put("free", Integer.toString(Log.getFreeMemMb()));
Log.breadcrumb("low", crumb);
super.onLowMemory(); super.onLowMemory();
} }

Loading…
Cancel
Save