ram-is-mine
Ensure that programs do not use more RAM memory than they are allowed to.
Some programs have their own malloc implementations and they do not return RAM to the OS.
I wanted to try this way. I could try to use ulimit and run the process with its own user, but I think it will be handy to have this program around.
It will add a bit of overhead for small allocations. This will be optimized later.
Usage
MY_RAM_LIMIT=$((1024*1024*1024*2)) LD_PRELOAD_64=./ram-is-mine.so LD_PRELOAD=./ram-is-mine.so test_1
Replace test_1 with your program.
Status
Unstable. It will crash your computer and kill the cat.
It is not released yet, it should be completed soon.
Build UNIX
Requirements:
Tested in Ubuntu 14.04.
-
glibc
- We rely on glibc symbol __libc_calloc (and friends) being present. Used during initialization.
-
uthash
- Ubuntu: uthash-dev
- Project: http://troydhanson.github.io/uthash/.
Credits
- This S.O. answer got me started.