Files
perfdb/pdb-ui/src/main/java/org/lucares/pdbui/PdbWebapp.java
Andreas Huber b7dc22275d trigger garbage collection periodically
This reduces the memory usage, because the old generation can be made
smaller and we don't have to wait until max heap usage has been reached.
2017-09-23 10:54:28 +02:00

30 lines
527 B
Java

package org.lucares.pdbui;
import java.util.concurrent.TimeUnit;
import org.springframework.boot.SpringApplication;
public class PdbWebapp {
public static void main(final String[] args) throws Exception {
SpringApplication.run(MySpringConfiguration.class, args);
Thread t = new Thread(()-> {
while(true){
try{
TimeUnit.MINUTES.sleep(10);
}catch(InterruptedException e)
{
// ignore
}
System.gc();
}
});
t.setDaemon(true);
t.setName("periodic-gc");
t.start();
}
}