fix(gui): check free memory after GC attempt

This commit is contained in:
Skylot
2022-04-05 19:46:10 +01:00
parent c9622c0771
commit 994973ac01
@@ -195,7 +195,11 @@ public class BackgroundExecutor {
// reduce thread count and continue
executor.setCorePoolSize(1);
System.gc();
UiUtils.sleep(500); // wait GC
UiUtils.sleep(1000); // wait GC
if (!UiUtils.isFreeMemoryAvailable()) {
LOG.error("Task '{}' memory limit reached (after GC), force cancel", task.getTitle());
return TaskStatus.CANCEL_BY_MEMORY;
}
}
return null;
};