How can I disable Java garbage collector?

后端 未结 8 1152
你的背包
你的背包 2020-12-08 19:16

We have a PHP webapp that calls a Java binary to produce a PDF report (with JasperReports). The Java binary outputs the PDF to standard output and exits; the PHP then sends

8条回答
  •  無奈伤痛
    2020-12-08 19:52

    Java 11 comes with an no-op garbage collector.

    It can be enabled by the -XX:+UseEpsilonGC option at JVM start.

    According to the JEP decription one of its goals is to make certain short-lived jobs more efficient, what might be you use case:

    Extremely short lived jobs. A short-lived job might rely on exiting quickly to free the resources (e.g. heap memory). In this case, accepting the GC cycle to futilely clean up the heap is a waste of time, because the heap would be freed on exit anyway. Note that the GC cycle might take a while, because it would depend on the amount of live data in the heap, which can be a lot.

提交回复
热议问题