Situation
I have root access to a virtual private server (on Dreamhost) where I host my web sites. I am limited by RAM (currently 500 MB) so if one site (script of this site) demands too much RAM my whole VPS is shut down and restarted, taking all other sites down with it!
My average usage is about 100 MB, so nowhere near the limit, yet somehow some script still does this: asks for too much RAM and then Dreamhost's watchdog kills my VPS. It all happens in milliseconds (so they say) and I can't easily find out what's happening.
Question
How can I find out what script is causing this? Dreamhost hasn't been helpful with this and I'm not exactly the best linux hacker :).
Some more details
All my sites are hosted on Apache and they are all in PHP.