开发者

What happens if memory leaks on rootfs?

I have a linux totally on rootfs ( which as I understand is an instance of ramfs ). There's no hard disk and no swap. And I got a process that leaks memory continuously. The virutal memory eventually grows to 4 times the size of physical memory, shown with top. I can't understand what's happening. rootfs is supposed to take RAM only, right ? If I have no disk to swap to, how开发者_如何学C does the Virtual Memory grows to 4 times the physical memory ?


Not all allocated memory has to be backed by a block device; the glibc-people consider this behavior a bug:

BUGS
   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.
   This is a really bad bug.  In case it turns out that the
   system is out of memory, one or more processes will be killed
   by the infamous OOM killer.  In case Linux is employed under
   circumstances where it would be less desirable to suddenly
   lose some randomly picked processes, and moreover the kernel
   version is sufficiently recent, one can switch off this
   overcommitting behavior using a command like:

       # echo 2 > /proc/sys/vm/overcommit_memory

   See also the kernel Documentation directory, files
   vm/overcommit-accounting and sysctl/vm.txt.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜