Garbage collect before/after sync

pull/214/head
M66B 11 months ago
parent 9769e774ea
commit 01383680d2

@ -173,7 +173,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
executor.submit(new Runnable() {
@Override
public void run() {
Helper.gc();
Helper.gc("Boundary start");
int free = Log.getFreeMemMb();
Map<String, String> crumb = new HashMap<>();
@ -228,7 +228,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
} finally {
state.queued.decrementAndGet();
Log.i("Boundary queued -" + state.queued.get());
Helper.gc();
Helper.gc("Boundary end");
crumb.put("queued", Integer.toString(state.queued.get()));
Log.breadcrumb("Boundary done", crumb);
@ -994,7 +994,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
ifolder = null;
imessages = null;
Helper.gc();
Helper.gc("Boundary reset");
}
}

@ -411,9 +411,9 @@ class Core {
break;
case EntityOperation.SYNC:
Helper.gc();
Helper.gc("Sync start");
onSynchronizeMessages(context, jargs, account, folder, (POP3Folder) ifolder, (POP3Store) istore, state);
Helper.gc();
Helper.gc("Sync end");
break;
case EntityOperation.PURGE:
@ -501,9 +501,9 @@ class Core {
break;
case EntityOperation.SYNC:
Helper.gc();
Helper.gc("Sync start");
onSynchronizeMessages(context, jargs, account, folder, (IMAPStore) istore, (IMAPFolder) ifolder, state);
Helper.gc();
Helper.gc("Sync end");
break;
case EntityOperation.SUBSCRIBE:

@ -1697,7 +1697,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
btnGC.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Helper.gc(true);
Helper.gc("Miscellaneous");
DB.shrinkMemory(v.getContext());
}
});

@ -3536,18 +3536,12 @@ public class Helper {
// Miscellaneous
static void gc() {
gc(false);
}
static void gc(boolean force) {
if (force || BuildConfig.DEBUG) {
static void gc(String reason) {
try {
Log.i("GC " + reason);
Runtime.getRuntime().gc();
try {
Thread.sleep(50);
} catch (InterruptedException ex) {
Log.e(ex);
}
} catch (Throwable ex) {
Log.e(ex);
}
}

Loading…
Cancel
Save