There are essentially 3 problems here:
1) Unicorn seems to be steadily filli
You appear to have two problems: 1) You have errors in the coordination of graceful restart causing old unicorn workers and the old master to stick around; 2) Your app (not unicorn) is leaking memory.
For the former, looking at your before_fork
code, it appears you're using the memory-constraining approach from the example config However, you have a typo in the .oldbin
file name (an extraneous back-tick at the end) which means you never signal the old process because you can't read the pid from a non-existent file.
For the later, you will have to investigate and drill. Look in your app for caching semantics that accumulate data over time; examine carefully all use of globals, class-vars, and class-instance-vars which can retain data references from request to request. Run some memory profiles to characterize your memory use. You can mitigate memory leakage by killing workers when they grow bigger than some upper limit; unicorn-worker-killer makes this easy.
Use unicorn-worker-killer, this makes it easier to kill workers who consume a lot of RAMs :)