Codeception, every test in a row consume more memory.

I am trying to test a class using Codeception in Yii2 advanced template. And it uses too much memory, when i run all the tests.

When i run tests separately they are fast and don’t use much memory, they all take about 10 mb, which is ok for me. But when i run them all, every test in a row uses more and more memory, and for example 6 tests use 645mb together.

I suppose they don’t clean memory somehow. How do i clean memory after each test?

It happened after codeception update, to 2.1.

Found the problem. I used Codeception/Specify blocks, which deep cloned everything.

I disabled cloning by default, setting the following in _bootstrap.php


More info can be found in the docs: