insert explicit 'System.gc()' call

This commit is contained in:
Glavo 2021-08-04 12:54:50 +08:00 committed by Yuhui Huang
parent 134f96be08
commit 1ad8beb49e
5 changed files with 18 additions and 1 deletions

View File

@ -106,6 +106,9 @@ public class HMCLGameRepository extends DefaultGameRepository {
} catch (IOException ex) {
Logging.LOG.log(Level.WARNING, "Unable to create launcher_profiles.json, Forge/LiteLoader installer will not work.", ex);
}
// https://github.com/huanghongxun/HMCL/issues/938
System.gc();
}
public void changeDirectory(File newDirectory) {

View File

@ -225,6 +225,9 @@ public final class VersionsPage extends BorderPane implements WizardPage, Refres
root.setContent(failedPane, ContainerAnimations.FADE.getAnimationProducer());
});
}
// https://github.com/huanghongxun/HMCL/issues/938
System.gc();
}).executor().start();
}

View File

@ -81,7 +81,12 @@ public class DatapackListPage extends ListPageBase<DatapackListPageSkin.Datapack
public void refresh() {
setLoading(true);
Task.runAsync(datapack::loadFromDir)
.withRunAsync(Schedulers.javafx(), () -> setLoading(false))
.withRunAsync(Schedulers.javafx(), () -> {
setLoading(false);
// https://github.com/huanghongxun/HMCL/issues/938
System.gc();
})
.start();
}

View File

@ -102,6 +102,9 @@ public final class ModListPage extends ListPageBase<ModListPageSkin.ModInfoObjec
itemsProperty().setAll(list.stream().map(ModListPageSkin.ModInfoObject::new).sorted().collect(Collectors.toList()));
else
getProperties().remove(ModListPage.class);
// https://github.com/huanghongxun/HMCL/issues/938
System.gc();
}, Platform::runLater);
}

View File

@ -100,6 +100,9 @@ public class WorldListPage extends ListPageBase<WorldListItem> implements Versio
itemsProperty().setAll(result.stream()
.filter(world -> isShowAll() || world.getGameVersion() == null || world.getGameVersion().equals(gameVersion))
.map(WorldListItem::new).collect(Collectors.toList()));
// https://github.com/huanghongxun/HMCL/issues/938
System.gc();
}, Platform::runLater);
}