首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >理解空闲-m内存的使用

问理解空闲-m内存的使用
EN

Unix & Linux用户
提问于 2015-02-03 18:40:38
回答 2查看 755关注 0票数 1

我不明白这一点。当free -m显示以下内容时:

代码语言:javascript
复制
             total       used       free     shared    buffers     cached
Mem:         15334      14025       1308          0        258      10918
-/+ buffers/cache:       2848      12485
Swap:          953          0        953

这是否意味着我的第1行有1.4GB的免费,或者第2行有12 or的免费?

我有Linux + Nginx + php-fpm + Mysql + Memcached

编辑:

我知道1.3GB是空闲的未使用内存,但是如果我们删除缓冲区的使用,实际上我的vps上有12 on的空闲内存。这是否意味着16 my的vps比我所需要的要高得多,而且我把它浪费在一台大机器上,因为它有12 my的免费空间?或者看第1行,我是否认为缓冲区使用了大量内存,这意味着我的机器仍然从大量的ram中受益,因为缓冲区的使用意味着更快的响应?

EN

回答 2

Unix & Linux用户

回答已采纳

发布于 2015-02-03 18:52:33

第一行显示了考虑(添加) cache和buffers的内存使用情况,即用于缓存数据或缓冲I/O的内存的一部分。

另一方面,第二行显示内存使用情况,不考虑(推导) cache和buffers。

现在,您可能想知道,如果一个新进程需要更多的内存,而不是在第一行(即考虑cache/buffers )中显示,那么在这个缓存中,cache中最古老的数据将被清除,以便为最新的进程腾出空间。因此,您不必担心缓存/缓冲所占用的巨大空间。

对编辑的回答:

更多的缓存意味着更快的响应。所以,除非它绝对困扰着你,否则你对此很在行。

票数 3
EN

Unix & Linux用户

发布于 2015-02-03 18:56:48

我建议免费查看手册页(见下面的摘录):

# man free

代码语言:javascript
复制
NAME
       free - Display amount of free and used memory in the system

SYNOPSIS
       free [options]

DESCRIPTION
       free displays the total amount of free and used physical and swap memory in the system, as well as the buffers and caches used by the kernel. The information is gath‐
       ered by parsing /proc/meminfo. The displayed columns are:

       total  Total installed memory (MemTotal and SwapTotal in /proc/meminfo)

       used   Used memory (calculated as total - free)

       free   Unused memory (MemFree and SwapFree in /proc/meminfo)

       shared Memory used (mostly) by tmpfs (Shmem in /proc/meminfo, available on kernels 2.6.32, displayed as zero if not available)

       buffers
              Memory used by kernel buffers (Buffers in /proc/meminfo)

       cached Memory used by the page cache  (calculated as Cached - Shmem in /proc/meminfo - the Cached value is actually the sum of page cache and tmpfs memory)
票数 0
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/182723

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档