Skip to content
🚰 PHPUnit Plugin for detecting Memory Leaks in code and tests
PHP Shell
Branch: master
Clone or download
Ocramius Merge pull request #24 from staabm/patch-1
Added hint on how the plugin works
Latest commit 37bab5a Nov 10, 2019

README.md

roave/no-leaks

Build Status Latest Stable Version

roave/no-leaks

This library is a PHPUnit plugin that detects memory leaks in tested code or tests. It utilizes memory_get_usage() to make sure the code beeing executed properly cleans up after itself.

Installation

composer require --dev roave/no-leaks

Usage

vendor/bin/roave-no-leaks

If any memory leaks are detected, you should see an output like following:

Exception: The following test produced memory leaks:
 * My\Leaky\Test::testSomething
 * My\Leaky\Test::testSomethingElse

Configuration and Parameters

vendor/bin/roave-no-leaks supports all configuration parameters and console parameters of PHPUnit.

Known Issues

Please be aware that this is not a full substitute for PHPUnit:

  • the output format is to be improved
  • memory leak detection for scalar types and arrays is not reliable
  • can fail depending on xdebug/phpdbg/php-sapi changes

Professional Support

If you need help with setting up this library in your project, you can contact us at team@roave.com for consulting/support.

You can’t perform that action at this time.