roave / no-leaks
Installs: 219 328
Dependents: 15
Suggesters: 0
Security: 0
Stars: 496
Watchers: 16
Forks: 19
Open Issues: 8
Requires
- php: ~8.1.0 || ~8.2.0
- ext-json: *
- phpunit/phpunit: ^9.6.10
Requires (Dev)
- doctrine/coding-standard: ^12.0.0
- psalm/plugin-phpunit: ^0.18.4
- roave/infection-static-analysis-plugin: ^1.32.0
- squizlabs/php_codesniffer: ^3.7.2
- vimeo/psalm: ^5.14.1
README
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 being 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.