in reply to creative forking (code)

How about using exec in the child process ? Then the child process can be running a separate, smaller script which would take up less memory.