答案1
我从中看不出什么,但重要的是RES
列,即“驻留集大小”。引用男士上衣:
RES - anything occupying physical memory which, beginning with
Linux-4.5, is the sum of the following three fields:
RSan - quadrant 1 pages, which include any
former quadrant 3 pages if modified
RSfd - quadrant 3 and quadrant 4 pages
RSsh - quadrant 2 pages
.
.
VIRT - everything in-use and/or reserved (all quadrants)
尽管VIRT
列显示 11.740 GB,RES
columns 仅 120.0 MB。大VIRT
可以达到所有内存映射缓存文件和所有malloc()
由于 Linux 的“乐观内存分配器”,生成的匿名映射尚未分配给物理内存页面。尝试访问其中一些页面可能仍会导致SIGSEGV
如果没有可用的物理页面,则会发生分段错误。
请参阅NOTES
部分man malloc
:
NOTES
By default, Linux follows an optimistic memory allocation strategy. This means that when
malloc() returns non-NULL there is no guarantee that the memory really is available. In
case it turns out that the system is out of memory, one or more processes will be killed
by the OOM killer. For more information, see the description of /proc/sys/vm/overcom‐
mit_memory and /proc/sys/vm/oom_adj in proc(5), and the Linux kernel source file Documen‐
tation/vm/overcommit-accounting.
希望这可以帮助。
格林威治标准时间42