Topic: Hanging Processes

I have a problem on my app that is causing it to keep throwing errors. My host has told me I have processes that are hanging and eating away at my RAM. I've been told to run:

pkill -9 -f ruby1.8

This has helped the problem, but I can't go in every day/hour/etc and kill hanging processes.

Does anyone have any recommendations on how to automate the killing of hanging processes or how to find out what processes are hanging? I'm not very versed at server admin, so any help is appreciated. I'm wondering if there's a plugin or something I can run to keep my app running clean or another ruby function I can tap into.

Thanks! Appreciate the help.