Java Garbage Collector - Not running normally at regular intervals

前端 未结 3 1841
终归单人心
终归单人心 2021-02-07 09:09

I have a program that is constantly running. Normally, it seems to garbage collect, and remain under about 8MB of memory usage. However, every weekend, it refuses to garbage col

3条回答
  •  孤街浪徒
    2021-02-07 09:40

    If possible, I would setup the process to dump the heap if it runs out of memory - so you can analyze it if (when) it happens again. Not an answer, but a potential route to a solution.

    Here are the JVM options, taken from Oracle's Java HotSpot VM Options page. (This assumes you have an Oracle JVM):

    -XX:HeapDumpPath=./java_pid.hprof

    Path to directory or filename for heap dump. Manageable. (Introduced in 1.4.2 update 12, 5.0 update 7.)

    -XX:-HeapDumpOnOutOfMemoryError

    Dump heap to file when java.lang.OutOfMemoryError is thrown. Manageable. (Introduced in 1.4.2 update 12, 5.0 update 7.)

提交回复
热议问题