Does Opcache fix eAccelerator's and XCache's memory leak bugs?

matteo asked:

Both XCache and eAccelerator have a memory leak bug which will leak memory if you include the same file tens of times in a loop, even though the code executed in the file does not use up any memory at all at each execution. (the exact same script without eAccelerator or XCache does not leak memory)

I replaced XCache with eAccelerator and at first I was not observing the bug but then it appeared.

Does OPCache have this fixed or does it suffer from the same bug?

I use PHP 5.4.29
If so, can I install OPCache from PECL and will it be the same as the one that comes bundled with PHP 5.5+ (that is, without the memory leak), or do I have to upgrade to PHP 5.5 or higher?

My answer:


If you think eAccelerator and XCache leak badly, try using APC, which just plain crashes PHP entirely.

In the couple of years I’ve been using OPcache I’ve never seen a memory leak or crash.

That said, you should update PHP anyway, as 5.4 will be end of life in just a few days.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.