Improve memory monitor to allow graceful exit (without breaking existing requests).

Fixes: #98 (safe workaround).

This is what it looks like: https://gist.github.com/samalba/dc27a4a7000bff194187

@shin- Could you test the branch locally and report back what you have with docker-registry?

Finally I decided not to make this configurable from the config, since I think it should be the default for people (open for discussion...).