Java: non-heap-memory analyzes

后端 未结 3 2052
太阳男子
太阳男子 2020-12-08 16:29

we have the problem that our non-heap-memory is growing all the time. so we have to restart our jee (java8) - webapp every 3rd day (as you can see in the screenshot here: sc

3条回答
  •  猫巷女王i
    2020-12-08 17:03

    Non-heap memory usage, as provided by MemoryPoolMXBean counts the following memory pools:

    • Metaspace
    • Compressed Class Space
    • Code Cache

    In other words, standard non-heap memory statistics includes spaces occupied by compiled methods and loaded classes. Most likely, the increasing non-heap memory usage indicates a class loader leak.

    Use

    • jmap -clstats PID to dump class loader statistics;
    • jcmd PID GC.class_stats to print the detailed information about memory usage of each loaded class. The latter requires -XX:+UnlockDiagnosticVMOptions.

提交回复
热议问题