大佬教程收集整理的这篇文章主要介绍了linux – 我的容器的内存在哪里?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
top - 16:56:51 up 6 days,17:25,0 users,load average: 0.16,0.27,0.31 Tasks: 4 @R_813_10586@l,1 running,3 sleeping,0 stopped,0 zombie %cpu(s): 1.3 us,0.7 sy,0.0 ni,98.0 id,0.0 wa,0.0 hi,0.0 si,0.0 st KiB Mem: 7676380 @R_813_10586@l,4089380 used,3587000 free,675164 buffers KiB Swap: 0 @R_813_10586@l,0 used,0 free. 2586496 cached Mem PID USER PR NI VIRT RES SHR S %cpu %MEM TIME+ COMMAND 1 root 20 0 46924 15196 6456 S 0.0 0.2 0:15.54 supervisord 8 root 20 0 3526084 47976 29660 S 0.0 0.6 0:59.15 dotnet 568 root 20 0 20364 3332 2728 S 0.0 0.0 0:00.09 bash 2800 root 20 0 21956 2420 2032 R 0.0 0.0 0:00.00 top
我此时报告的数字是90M,但没有加起来.我很确定/sys/fs/cgroup/memory/memory.usage_in_bytes是报道的内容:
> cd /sys/fs/cgroup/memory/ > cat cgroup.procs 1 8 568 2494 > cat memory.usage_in_bytes 92282880 > pmap -p 1 | tail -n 1 @R_813_10586@l 46924K > pmap -p 8 | tail -n 1 @R_813_10586@l 3599848K > pmap -p 568 | tail -n 1 @R_813_10586@l 20364K > ps 2494 PID TTY STAT TIME COMMAND
在我看来,这里有大量内存“缺失”……如果我在输入内容时再次使用memory.usage_in_bytes:
> cat memory.usage_in_bytes 112291840 > pmap -p 1 | tail -n 1 @R_813_10586@l 46924K > pmap -p 8 | tail -n 1 @R_813_10586@l 3452320K > pmap -p 568 | tail -n 1 @R_813_10586@l 20368K
没有什么能明显解释这种内存使用情况.如果我看看memory.stat,我看到了这个:
# cat memory.stat cache 89698304 RSS 30699520 RSS_huge 0 mapped_file 1552384 writeBACk 0 pgpgin 102007 pgpgout 72613 pgfault 115021 pgmajfault 8 inactive_anon 1519616 active_anon 30789632 inactive_file 417792 active_file 87654400 unevictable 4096 hierarchical_memory_limit 18446744073709551615 @R_813_10586@l_cache 89698304 @R_813_10586@l_RSS 30699520 @R_813_10586@l_RSS_huge 0 @R_813_10586@l_mapped_file 1552384 @R_813_10586@l_writeBACk 0 @R_813_10586@l_pgpgin 102007 @R_813_10586@l_pgpgout 72613 @R_813_10586@l_pgfault 115021 @R_813_10586@l_pgmajfault 8 @R_813_10586@l_inactive_anon 1519616 @R_813_10586@l_active_anon 30789632 @R_813_10586@l_inactive_file 417792 @R_813_10586@l_active_file 87654400 @R_813_10586@l_unevictable 4096
然后片刻之后:
# cat memory.stat cache 89972736 RSS 30777344 RSS_huge 0 mapped_file 1552384 writeBACk 0 pgpgin 102316 pgpgout 72836 pgfault 115674 pgmajfault 8 inactive_anon 1519616 active_anon 30867456 inactive_file 417792 active_file 87928832 unevictable 4096 hierarchical_memory_limit 18446744073709551615 @R_813_10586@l_cache 89972736 @R_813_10586@l_RSS 30777344 @R_813_10586@l_RSS_huge 0 @R_813_10586@l_mapped_file 1552384 @R_813_10586@l_writeBACk 0 @R_813_10586@l_pgpgin 102316 @R_813_10586@l_pgpgout 72836 @R_813_10586@l_pgfault 115674 @R_813_10586@l_pgmajfault 8 @R_813_10586@l_inactive_anon 1519616 @R_813_10586@l_active_anon 30867456 @R_813_10586@l_inactive_file 417792 @R_813_10586@l_active_file 87928832 @R_813_10586@l_unevictable 4096
但我会说实话;我真的不知道我在这看什么.我怀疑地看着active_file但是又一次;我真的不知道我在看什么.
一些注意事项和观察:
>容器由Kubernetes安排.@H_419_25@>该程序将大量数据写入stdout.@H_419_25@>将写入控制台的数据量减少到接近零可以解决报告的内存泄漏问题.@H_419_25@>部署只向stdout写入大量数据的程序似乎没有表现出相同的内存泄漏(!)
所以!我该如何去寻找这个记忆被消耗的地方?对任何人来说有什么明显的东西 – 也许是某种东西盯着我的脸,或者我不是在看我应该做的事情?
谢谢!
以上是大佬教程为你收集整理的linux – 我的容器的内存在哪里?全部内容,希望文章能够帮你解决linux – 我的容器的内存在哪里?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。