首页 新闻 会员 周边

dotnet 虚拟内存占用这么高吗

0
悬赏园豆:10 [已解决问题] 解决于 2018-12-14 09:56

 

这数据不对劲吧,普通的api站点,刚启动就20g了

shangsharon的主页 shangsharon | 菜鸟二级 | 园豆:251
提问于:2018-12-14 08:55
< >
分享
最佳答案
1

VIRT 并不是表示进程所占用的内存,而是表示进程可以访问的内存空间,详见 What does Virtual memory size in top mean?

VIRT represents how much memory the program is able to access at the present moment.

github 上也有人提出过这个问题 High virtual memory usage on Ubuntu 16,得到的回答是:

please note that the high virtual memory usage is not an issue. It doesn't cost you anything (except for a bit of memory for the processor page tables), since this space is private to each process. So even if it was using hundreds of gigabytes of VM or more, it would still be ok.

收获园豆:10
dudu | 高人七级 |园豆:30925 | 2018-12-14 09:46

感谢你的回答,我也有这个困惑,还有我也补充一个官方文档,解释为什么这种情况不是内存溢出,而且内存一般是75%左右:

引用:

  • The default value, which only applies in certain cases, is the lesser of 20 MB or 75% of the memory limit on the container. The default value applies if:
    • The process is running inside a container that has a specified memory limit.
    • System.GC.HeapHardLimit is not set.
  • 也就是当容器的内存使用率超过一个百分比(默认75%)或一个固定值(如果你设置了)那么就会达到垃圾回收的条件的第二条,从而执行垃圾回收;
  • 如果单纯想让内存占用降下来可尝试文档中的设置,但一般没必要
大师兄石头 | 园豆:63 (初学一级) | 2021-01-20 16:06
其他回答(2)
0

你的电脑内存真多!

爱编程的大叔 | 园豆:30844 (高人七级) | 2018-12-14 09:24

8G内存,7G swap,但是swap一点没用上.但是这个数据太怪了吧,你们也是这样的吗?

支持(1) 反对(0) shangsharon | 园豆:251 (菜鸟二级) | 2018-12-14 09:26
0

这里是对应分配的虚拟内存地址,而不是占用的虚拟内存大小

天翔者 | 园豆:202 (菜鸟二级) | 2018-12-14 09:33
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册