I've also had this problem on CentOS.
It seems that usleep() is causing the memory leak. For some reason usleep() seems to kill the httpd script, and httpd processes (as indicated by the "top" shell command) eventually overload the server.
After removing usleep() from my script, no more memory leaks.