关闭DirectByteBuffer
在 Docker 容器内运行的 Java 应用程序(大量使用 )后,有很多未计入的已用内存:
$ free -hg
total used free shared buff/cache available
Mem: 755G 305G 449G 17M 448M 448G
Swap: 4.0G 0B 4.0G
做这样的事情:
$ ps -e -o pid= -o comm= -o rss= | awk 'BEGIN{rss_total = 0} {rss_total = rss_total + $3} END {print "RSS total(GB): " rss_total/1024/1024}'
RSS total(GB): 0.698826
我缺少大约300GB(!)的内存。
我知道 RSS 的总和与 free 报告的数字不匹配(由于共享页面、缓冲区、缓存等),但仍然...... 300GB?
以下内容/proc/meminfo
:
MemTotal: 792419424 kB
MemFree: 471276328 kB
MemAvailable: 470340492 kB
Buffers: 52 kB
Cached: 272672 kB
SwapCached: 0 kB
Active: 477128 kB
Inactive: 170892 kB
Active(anon): 365132 kB
Inactive(anon): 27764 kB
Active(file): 111996 kB
Inactive(file): 143128 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 4194300 kB
SwapFree: 4194300 kB
Dirty: 8 kB
Writeback: 0 kB
AnonPages: 375316 kB
Mapped: 216800 kB
Shmem: 17596 kB
Slab: 191792 kB
SReclaimable: 58096 kB
SUnreclaim: 133696 kB
KernelStack: 14512 kB
PageTables: 13808 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 400404012 kB
Committed_AS: 2241808 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 1787248 kB
VmallocChunk: 33821919228 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 450496 kB
DirectMap2M: 804855808 kB
该应用程序利用Active Pivot内存数据库。
服务器vm.overcommit_memory = 1
在 Active Pivot 组件的要求下运行。