Detecting Memory Leaks in PHP Extensions During Development
When a PHP extension has a memory leak, mysterious crashes can result, forcing users to restart the web server for relief.
As official maintainers of the ibm_db2 and PDO_IBM extensions, we’ve been on a quest to find and eliminate any memory leaks from these popular PHP modules.
With such a comprehensive goal, we needed a strategy. For extensions that have comprehensive test suites we decided that, in addition to reviewing the usual regression tests, why not also use the tests to detect leaks?
What follows is a technical look at how we do it.