Run full GC periodically to try to fight memory issue with ImageIO objects with large offheap allocations (?)

This commit is contained in:
Sean Owen 2017-08-16 12:31:18 +01:00
parent 7a5038a070
commit 0000a10272
2 changed files with 8 additions and 1 deletions

View file

@ -83,7 +83,7 @@ import javax.servlet.http.Part;
@MultipartConfig(
maxFileSize = 1L << 26, // ~64MB
maxRequestSize = 1L << 26, // ~64MB
fileSizeThreshold = 1 << 20, // ~1MB
fileSizeThreshold = 1 << 23, // ~8MB
location = "/tmp")
@WebServlet(value = "/w/decode", loadOnStartup = 1)
public final class DecodeServlet extends HttpServlet {

View file

@ -82,6 +82,13 @@ public final class DoSFilter implements Filter {
bannedIPAddresses.clear();
}
}, 0L, TimeUnit.MILLISECONDS.convert(15, TimeUnit.MINUTES));
timer.scheduleAtFixedRate(
new TimerTask() {
@Override
public void run() {
System.gc();
}
}, 0L, TimeUnit.MILLISECONDS.convert(15, TimeUnit.MINUTES));
}
@Override