Add option to command line for setting memory allowed

This commit is contained in:
Laurent Clouet
2017-04-04 23:06:31 +02:00
parent 39bd52aca4
commit ff9ef365aa

View File

@@ -67,6 +67,9 @@ public class Worker {
@Option(name = "-cores", usage = "Number of cores/threads to use for the render", metaVar = "3", required = false)
private int nb_cores = -1;
@Option(name = "-memory", usage = "Maximum memory allow to be used by renderer (in MB)", required = false)
private int max_ram = -1;
@Option(name = "--verbose", usage = "Display log", required = false)
private boolean print_log = false;
@@ -198,6 +201,10 @@ public class Worker {
config.setUseNbCores(nb_cores);
}
if (max_ram > 0) {
config.setMaxMemory(max_ram * 1000);
}
if (method != null) {
try {
compute_method = ComputeType.valueOf(method);