What are the limits for a CGI script?
In order to protect the server from poorly designed CGI scripts that might consume all available system resources, limits are placed on a script when it runs. Limits at the time this is written include use of up to 10 seconds of CPU time, writing up to 256KB to a file and using up to 16MB of memory. If a script exceeds a limit, it will be terminated. The actual requirements of a typical script are low. Most scripts execute in one or two seconds, do not write much information to a file (if any) and do not require much memory. More memory is required as more modules are loaded or as more data is stored in memory. To lower memory requirements, check whether you need to load all of the modules at one time. Determine if there is a way to read and write only necessary information in a file rather than the whole file.