Open arrilot opened 1 year ago
Can you try this without the generator? Could also be phpunit which expands the generator for each test case or something. Just to confirm.
This has nothing to do with generator or phpunit because the issue is gone if codeception Yii2 module is turned off We also face the very same issue with our real test suit consisting of hundreds unique tests and no generators.
In fact. I've managed to find the exact line which results in memory leak
https://github.com/Codeception/module-yii2/blob/master/src/Codeception/Lib/Connector/Yii2.php#L299
If we comment it out:
Time: 00:04.577, Memory: 18.00 MB
OK (1000 tests, 1000 assertions)
With it:
Time: 00:06.544, Memory: 300.00 MB
OK (1000 tests, 1000 assertions)
Looks like a container is leaking a bunch of memory
Steps to reproduce:
vendor/bin/codecept run tests/unit/leak/A500Test.php
vendor/bin/codecept run tests/unit/leak/A1000Test.php
1000 tests consumed twice as much memory as 500 tests. Module is not freeing 300kb of memory after each iteration of one test
vendor/bin/codecept run tests/unit/leak/
Module is not freeing 300kb of memory after each test even after all tests in a file were finished
unit.suite.yml
Memory usage is 20 smaller
phpinfo.txt