Previous: Limiting object usage, Up: Limiting memory usage [Contents][Index]
Many operating systems permit limiting a process’ memory usage by
setting a usage limit; on most Unix-like systems, this is done
with the -v option to the ulimit
command.
Typically, the effect is to cause calls to the malloc
and
mmap
library functions to fail.
Polipo will usually react gracefully to failures to allocate memory14. Nonetheless, you should avoid using OS limits to limit Polipo’s memory usage: when it hits an OS limit, Polipo cannot allocate the memory needed to schedule recovery from the out-of-memory condition, and has no choice other than to drop a connection.
Unfortunately, some operating system kernels (notably certain Linux releases) fail to fail an allocation if no usage limit is given; instead, they either crash when memory is exhausted, or else start killing random processes with no advance warning15. On such systems, imposing an (unrealistically large) usage limit on Polipo is the safe thing to do.