为什么Java本地内存跟踪中的内部内存在增加?
为什么Java本地内存跟踪中的内部内存在增加?
我的应用程序运行在一个docker容器中,它使用scala,并使用\"OpenJDK 64-Bit Server VM (build 25.102-b14, mixed mode)\",它的Xmx被设置为16GB,容器内存限制为24GB,在运行一段时间后容器被杀死:
Last State: Terminated Reason: OOMKilled Exit Code: 137
然而,在所有的48个节点中,在过去的两周中,我在日志中没有发现任何\"java.lang.OutOfMemoryError: Java heap space\"错误,所以不太可能是普通的堆OOM。
dmesg输出:
$ dmesg -l err,crit,alert,emerg STDIN is not a terminal [1647254.978515] Memory cgroup out of memory: Kill process 10924 (java) score 1652 or sacrifice child [1647254.989138] Killed process 10924 (java) total-vm:34187148kB, anon-rss:24853120kB, file-rss:23904kB [1655749.664871] Memory cgroup out of memory: Kill process 1969 (java) score 1652 or sacrifice child [1655749.675513] Killed process 1969 (java) total-vm:35201940kB, anon-rss:24856624kB, file-rss:24120kB [1655749.987605] Memory cgroup out of memory: Kill process 2799 (java) score 1656 or sacrifice child
然后我多次运行JCMD,直到它再次被杀死,数据看起来如下:
Native Memory Tracking:
Total: reserved=25505339KB, committed=25140947KB
- Java Heap (reserved=16777216KB, committed=16777216KB)
(mmap: reserved=16777216KB, committed=16777216KB)
- Class (reserved=247996KB, committed=93500KB)
(classes #14539)
(malloc=2236KB #29794)
(mmap: reserved=245760KB, committed=91264KB)
- Thread (reserved=1013160KB, committed=1013160KB)
(thread #1902)
(stack: reserved=1003956KB, committed=1003956KB)
(malloc=6240KB #9523)
(arena=2964KB #3803)
- Code (reserved=263255KB, committed=86131KB)
(malloc=13655KB #20964)
(mmap: reserved=249600KB, committed=72476KB)
- GC (reserved=776174KB, committed=776174KB)
(malloc=120814KB #164310)
(mmap: reserved=655360KB, committed=655360KB)
- Compiler (reserved=812KB, committed=812KB)
(malloc=681KB #1823)
(arena=131KB #3)
- Internal (reserved=6366260KB, committed=6366256KB)
(malloc=6366256KB #178778)
(mmap: reserved=4KB, committed=0KB)
- Symbol (reserved=18391KB, committed=18391KB)
(malloc=16242KB #153138)
(arena=2150KB #1)
- Native Memory Tracking (reserved=9002KB, committed=9002KB)
(malloc=186KB #2000)
(tracking overhead=8816KB)
- Arena Chunk (reserved=273KB, committed=273KB)
(malloc=273KB)
- Unknown (reserved=32800KB, committed=32KB)
(mmap: reserved=32800KB, committed=32KB)
我注意到的一件事是这个部分:
Internal (reserved=6366260KB, committed=6366256KB)
它不断增长,导致总内存使用量超过了 24GB 的限制。
有没有人以前遇到过类似的问题? 有没有人知道这里的内部内存是什么,以及为什么它不断增长而不释放内存的原因?