I'm trying to limit the memory usage of firefox
to prevent it from stalling the whole system with problematic web sites.
I tried, in bash
:
(ulimit -d 1000; firefox) &
This should limit the memory usage to 1000kB. Then I opened YouTube, and noticed, in top
, that firefox
is using 2.6% of the memory, or about 200MB, and not crashing. Clearly the limit is being ignored. Why is that, and how can I enforce it correctly?
-d
supposed to limit the heap? I thought the heap was considered separate from the data segment, but the manpage forsetrlimit(2)
says thatRLIMIT_DATA
setsThe maximum size of the process's data segment (initialized data, uninitialized data, and heap).
ulimit -d 1000; firefox
? Also, doesulimit -m
do what you want?