免费命令中可用的v/s空闲内存是什么?

时间:2022-09-17 22:19:36

The output of the free command that I fired on my linux host is as belows:

我在linux主机上启动的*命令的输出如下所示:

free
              total        used        free      shared  buff/cache   available
Mem:      263846320    47746620     3290072     1140808   212809628   214382420
Swap:             0           0           0

I am not able to figure out what this available part is specifying. The free memory is very less shown i.e around 1.24% even though the total memory is way high and used memory is around 18.09% only.

我不知道这个可用的部分指定了什么。空闲内存很少显示i。虽然总内存非常高,而使用内存仅为18.09%,但在1.24%左右。

free -h
              total        used        free      shared  buff/cache   available
Mem:           251G         45G        3.1G        1.1G        202G        204G
Swap:            0B          0B          0B

Does it mean I wont be able to start more applications as free memory is very less. The used memory is 18% only. So shouldn't free memory be 82% and not 1.24% as the command is showing above.

这是否意味着我无法启动更多的应用程序,因为空闲内存非常少。使用的内存仅为18%。不应该是82%而不是1。24%就像上面的命令一样。

I am confused. Can anyone help?

我困惑。谁能帮忙吗?

1 个解决方案

#1


13  

Modern operating systems go out of their way to keep as little memory free as possible. Memory that is free is actually harder to use because it has to be transitioned from free to in use. Memory that is already in use, that is, memory that is available but not free, can easily be switched to another use.

现代操作系统竭尽全力保持尽可能少的内存空闲。免费的内存实际上很难使用,因为它必须从免费转换为使用。已经在使用的内存,即可用但不是空闲的内存,可以很容易地切换到其他使用。

All this is normal. Free memory is wasted and does not make your system faster.

这一切都是正常的。空闲内存会被浪费,不会使系统运行得更快。

If you're thinking "but I want my memory free now so I can use it later", realize that this makes no sense. You can't save memory for later. A system with 4GB that uses 2GB today can't use 6GB tomorrow. You can use your memory both now and later. There is no tradeoff here -- using memory is free. The only alternative to using memory is wasting it. Why would you want your system to waste more memory?

如果你在想“但是我现在想要我的内存,所以我以后可以用它”,你要意识到这毫无意义。你不能把记忆留到以后。今天使用2GB的4GB系统明天不能使用6GB。你现在和以后都可以使用你的记忆。这里没有权衡——使用内存是免费的。使用内存的唯一选择就是浪费它。为什么你希望你的系统浪费更多的内存?

#1


13  

Modern operating systems go out of their way to keep as little memory free as possible. Memory that is free is actually harder to use because it has to be transitioned from free to in use. Memory that is already in use, that is, memory that is available but not free, can easily be switched to another use.

现代操作系统竭尽全力保持尽可能少的内存空闲。免费的内存实际上很难使用,因为它必须从免费转换为使用。已经在使用的内存,即可用但不是空闲的内存,可以很容易地切换到其他使用。

All this is normal. Free memory is wasted and does not make your system faster.

这一切都是正常的。空闲内存会被浪费,不会使系统运行得更快。

If you're thinking "but I want my memory free now so I can use it later", realize that this makes no sense. You can't save memory for later. A system with 4GB that uses 2GB today can't use 6GB tomorrow. You can use your memory both now and later. There is no tradeoff here -- using memory is free. The only alternative to using memory is wasting it. Why would you want your system to waste more memory?

如果你在想“但是我现在想要我的内存,所以我以后可以用它”,你要意识到这毫无意义。你不能把记忆留到以后。今天使用2GB的4GB系统明天不能使用6GB。你现在和以后都可以使用你的记忆。这里没有权衡——使用内存是免费的。使用内存的唯一选择就是浪费它。为什么你希望你的系统浪费更多的内存?