in reply to Monitoring the death of oversized Perl processes
Maybe you can draw some inspiration from Apache2::SizeLimit.