OS usage limits - The Polipo Manual
Description: The Polipo Manual

Previous: Limiting object usage, Up: Limiting memory usage

#### 5.3.3 OS usage limits

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 memory1. 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 warning2. On such systems, imposing an (unrealistically large) usage limit on Polipo is the safe thing to do.

#### Footnotes

[1] There are exactly three places in the code where Polipo will give up and exit if out of memory; all three are extremely unlikely to happen in practice.

[2] How I wish for a ``SIGXMEM`' signal.