Date: Sat, 02 Jun 2018 18:16:10 -0400 From: Brennan Vincent <brennan@umanwizard.com> To: freebsd-questions@freebsd.org Subject: Is it normal that a user can take down the whole system by using too much memory? Message-ID: <1527977770.2651378.1394286400.0806CC5C@webmail.messagingengine.com>
next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --_----------=_152797777026513781 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" The attached program `eatmem.c` is a simple example to waste N gigs of memory as quickly as possible. When I run something like `eatmem 32` (on a system with less than 32GB of RAM), about half the time everything works fine: the system quickly runs out of RAM and swap, the kernel kills `eatmem`, and everything recovers. However, the other half of the time, the system becomes completely unusable: my ssh session is killed, important processes like `init` and `getty` are killed, and it's impossible to even log into the system (the local terminal is unresponsive, and I can't ssh in because sshd is killed immediately whenever it tries to run). The only way to recover is by rebooting. Is this expected behavior? My system details are as follows: FreeBSD 12 CURRENT x86_64 guest on VMWare Fusion. ram: 8 GB swap: 1 GB Host: macbook pro running macOS. --_----------=_152797777026513781 Content-Disposition: attachment; filename="eatmem.c" Content-Id: <1527977409.2650163.6e127ffd81b5cf25772b7b863610084a2a170cfd.6AAE3585@content.messagingengine.com> Content-Transfer-Encoding: base64 Content-Type: text/plain; name="eatmem.c" I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCiNkZWZp bmUgUEFHRV9TSVpFIDQwOTYKaW50IG1haW4oaW50IGFyZ2MsIGNoYXIgKiph cmd2KQp7CglzaXplX3QgZ2IgPSBhdG9pKGFyZ3ZbMV0pOwoJc2l6ZV90IHN6 ID0gZ2IgKiAxMDI0ICogMTAyNCAqIDEwMjQ7Cgl2b2xhdGlsZSBjaGFyICpt ZW0gPSBtYWxsb2Moc3opOwoJaWYgKCFtZW0pIHsKCQlmcHJpbnRmKHN0ZGVy ciwgIkNvdWxkbid0IG1hbGxvYyFcbiIpOwoJCXJldHVybiAtMTsKCX0KCXdo aWxlICgxKQoJCWZvciAoc2l6ZV90IGkgPSAwOyBpIDwgc3o7IGkgKz0gUEFH RV9TSVpFKQoJCQltZW1baV0gPSAwOwp9Cg== --_----------=_152797777026513781--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1527977770.2651378.1394286400.0806CC5C>