mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-20 13:17:08 +00:00
Wait 50 ms after gc
This commit is contained in:
parent
5e4f8b5d1e
commit
399d2f7917
4 changed files with 17 additions and 8 deletions
|
@ -156,7 +156,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
|||
return;
|
||||
}
|
||||
|
||||
Runtime.getRuntime().gc();
|
||||
Helper.gc();
|
||||
|
||||
int free = Log.getFreeMemMb();
|
||||
Map<String, String> crumb = new HashMap<>();
|
||||
|
@ -203,7 +203,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
|||
}
|
||||
});
|
||||
} finally {
|
||||
Runtime.getRuntime().gc();
|
||||
Helper.gc();
|
||||
|
||||
crumb.put("free", Integer.toString(Log.getFreeMemMb()));
|
||||
Log.breadcrumb("Boundary done", crumb);
|
||||
|
@ -652,7 +652,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
|||
ifolder = null;
|
||||
imessages = null;
|
||||
|
||||
Runtime.getRuntime().gc();
|
||||
Helper.gc();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -326,9 +326,9 @@ class Core {
|
|||
break;
|
||||
|
||||
case EntityOperation.SYNC:
|
||||
Runtime.getRuntime().gc();
|
||||
Helper.gc();
|
||||
onSynchronizeMessages(context, jargs, account, folder, (POP3Folder) ifolder, (POP3Store) istore, state);
|
||||
Runtime.getRuntime().gc();
|
||||
Helper.gc();
|
||||
break;
|
||||
|
||||
case EntityOperation.PURGE:
|
||||
|
@ -406,9 +406,9 @@ class Core {
|
|||
break;
|
||||
|
||||
case EntityOperation.SYNC:
|
||||
Runtime.getRuntime().gc();
|
||||
Helper.gc();
|
||||
onSynchronizeMessages(context, jargs, account, folder, (IMAPStore) istore, (IMAPFolder) ifolder, state);
|
||||
Runtime.getRuntime().gc();
|
||||
Helper.gc();
|
||||
break;
|
||||
|
||||
case EntityOperation.SUBSCRIBE:
|
||||
|
|
|
@ -532,7 +532,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
btnGC.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Runtime.getRuntime().gc();
|
||||
Helper.gc();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -1667,6 +1667,15 @@ public class Helper {
|
|||
|
||||
// Miscellaneous
|
||||
|
||||
static void gc() {
|
||||
Runtime.getRuntime().gc();
|
||||
try {
|
||||
Thread.sleep(50);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
static <T> List<List<T>> chunkList(List<T> list, int size) {
|
||||
List<List<T>> result = new ArrayList<>(list.size() / size);
|
||||
for (int i = 0; i < list.size(); i += size)
|
||||
|
|
Loading…
Reference in a new issue