简体   繁体   English

Yii2中的代码接收,连续的每个测试都消耗更多的内存

[英]Codeception in Yii2, every test in a row consume more memory

I am trying to test a class using Codeception in Yii2 advanced template. 我正在尝试使用Yii2高级模板中的Codeception测试类。 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. 当我分别运行测试时,它们速度很快且不占用太多内存,它们全部占用约10 mb的内存,对我来说还可以。 But when i run them all, every test in a row uses more and more memory, and for example 6 tests use 645mb together. 但是当我全部运行它们时,连续的每个测试都使用越来越多的内存,例如6个测试一起使用645mb。

I suppose they don't clean memory somehow. 我想他们不会以某种方式清除内存。 How do i clean memory after each test? 每次测试后如何清理内存?

It happened after codeception update, to 2.1. 它发生在代码接收更新到2.1之后。

Found the problem. 找到了问题。 I used Codeception/Specify blocks, which deep cloned everything. 我使用了Codeception / Specify块,它深深地克隆了所有东西。

I disabled cloning by default, setting the following in _bootstrap.php \\Codeception\\Specify\\Config::setDeepClone(false); 我默认禁用克隆,在_bootstrap.php \\Codeception\\Specify\\Config::setDeepClone(false);设置以下内容\\Codeception\\Specify\\Config::setDeepClone(false);

More info can be found in the docs: https://github.com/Codeception/Specify#global-configuration 可以在文档中找到更多信息: https : //github.com/Codeception/Specify#global-configuration

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM