DataDog/dd-agent — pull request #429 by echohead (2013-03-31 20:17:29+00:00)
Title: Restart agent if it uses too much memory:

Augment the Watchdog to restart the agent process
not only if it has been running longer than the restart
interval, but also if the agent process exceeds a
memory threshold.

The obvious way to do this would be setrlimit with a max
RSS size, and allow the process to die with a MemoryError
when it is exceeded, but the Tornado library being used
swallows MemoryErrors and allows the process to continue.

In order to ensure the process is terminated, the current
memory usage is checked in the Watchdog-reset method, and
the process is aborted if the threshold is exceeded.