Thanks for your continuing discussions, as the person who
 gave this suggestion,  I want to express my ideas.
1. The focus of this suggesting is that to free
the occupied memory in order to memory can be used
 efficiently, at the same time, system have more free memory
to allocate. This has noting to do with how many memory the
 server has, usually our server have 16GB memory, and sometimes
our server also crashes. Though this requirement my be associated
with the error handler of Imagick self,  our aim is to let it run
 more valueable. And other circumstances maybe have this problem ,
such as large data operating, and the occupied memory will not
be freed until the process exit.
2. The PHP's management of memory can't give the occupied memory
back to the system by itself.
3.Though the idea is good,it cannot acquiret the actual state of
 the memory usage of the process for PHP. Meanwhile,the other
methods are not good enough in a way,such as cannot run on
multi-platform.So we hope to try to monitor and manage the heap
memory.After all,the used memory of PHP itself is relatively
stationary.And the memory_limit  is ought to limit the heap memory.
So, when it go beyond the limit,kill the process in order to release
 the memory.
4. I'm agree that it's not necessary to realize this feature in
SAPI, but it may be not easy to realize in other pleaces, because
 it  must check after current task execute, and SAPI is not all like
 FPM that is independent process existing.
5. Now that FPM is one process manager , it allows work processes
exit after excuting some times, and it kills work processes according
 to the memory usage is the similar requirement.
6. I do not install memtrack, according to the README, I think it's
not my really want , the focus of my requirement is not to log or
throw exception, because I know my problem is what, I need to solve
it, and the solution is to exit.
7. Now our solution to handle this problem is
  (1) control max_requests little as possible
  (2) control memory_limit low as possiable
  (3) write a shell , check the process usage, kill it when memory
  out of limit.
and we think if this suggestion could be accepted, wo can let config
 more easy , at the same time, memory can be use more efficiently.
Because shell maybe kill the process which is handling request.

I also hope that it can be realized in SAPI or other places,  before
there is no more better solution, first to achieve this relatively
short-term solution.

Reply via email to