Situation:
I am writing a program in C that maintains a number of threads. Once a thread ends, a new one is created.
Each thread forks - the child runs a PHP process via exec() and the parent waits for it to finish.
Each PHP process takes the next item from a queue, processes it and exits.
Problem:
The PHP processes are Symfony tasks and Symfony requires a fairly huge amount of memory. How can I safely calculate the required stack space for each thread so that PHP processes will have enough memory?
The memory limit set in php.ini is 128Mb so should I allocate this much space in the stack?
When you fork
you get a new process, when you exec
the process is replaced by the one you execute. So any setting of stack space in the C program are irrelevant with regards to PHP memory usage.