I have a 32GB machine and running over 2000 test cases using phpdbg for code coverage.
phpdbg -qrr -d memory_limit=-1./vendor/phpunit/phpunit/phpunit --debug --verbose
After running for some time, it throws the following error even memory_limit
is -1
map() failed: [12] Cannot allocate memory [ PHP Fatal error: Out of memory (allocated 5830606848) (tried to allocate 65536 bytes) ]
You are likely leaking memory and not getting it cleaned up. There are plugins that will report how much memory each test uses, and others that will try to automatically clean up - though with the update to PHPunit v6+, some may need attention to work with the namespace testcase classes.
One that tries to free-up memory is 'mybuilder/phpunit-accelerator', but if you can find particularly memory-heavy test classes, you can manually null-out the variables being used in a teardown() function.
Making sure that you are only collecting coverage data for your own code (src/, and maybe tests/) will also save a huge amount of memory (and time) - but whitelist the 'src/' directory and don't try to blacklist/exclude 'vendor/'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With