After I thought I understood memory manager after all, this comes along. I have a behavior I can’t understand or explain. Let’s see if anyone can solve the puzzle.
You have a machine, lets say with 8GB Ram. You only run a small number of process on that machine and you want to add another service.
You run free -m and it looks like this:
total used free shared buffers cached Mem: 7980 4814 3165 0 1 4593 -/+ buffers/cache: 220 7759 Swap: 1759 0 1759
And you think hey, no problem a lot of free memory available. 220MB “real used” memory and 7759MB “freeable memory”. Let’s bring it on.
You start you application (I use memhog from numactl) which eats 4G of RAM and gives you a OOM.
Who knows why?
(The solution is attached as base64 encoded block) To get a peek simple execute the block in a shell.
cat << EOF | openssl base64 -d VGhlIHByb2JsZW0gbGllcyBpbiB0aGUgZmFjdCB0aGF0IHRlbXBmcyBpbiAvZGV2 L3NobSBpcyBmdWxsLgpXaHkgdGhlIGNvbnRlbnQgb2YgL2Rldi9zaG0vIGlzIGNv bnNpZGVyZWQgY2FjaGUgYW5kIG5vdCB1c2VkIGlzIGJleW9uZCBtZS4gQnV0IGl0 IGlzIHRoaXMgd2F5LgoK EOF
I would still love an explanation why it is that way.