phpunit icon indicating copy to clipboard operation
phpunit copied to clipboard

Depends functionality contains memory leak

Open Guite opened this issue 2 years ago • 2 comments

Q A
PHPUnit version 10.1
PHP version 8.2.5
Installation Method Composer

Summary

When test cases are related with each other using the "depends" attribute/annotation PHPUnit 10 uses much more memory than PHPUnit 9 did. It feels like it would clone the object that is assigned to the dependent test case instead of using a reference to the existing one.

Current behavior

Currently assigning objects to a dependent test case uses additional memory. Calling a private (non-test) method instead does not.

How to reproduce

Create a sequence/cascade of test cases that return objects and assign them to the next one.

Expected behavior

Switching from PHPUnit 9 to 10 should not cause huge differences with regards to memory consumption.

Guite avatar May 10 '23 08:05 Guite

Thank you for your report.

Please provide a minimal, self-contained, reproducing test case that shows the problem you are reporting.

Without such a minimal, self-contained, reproducing test case I will not be able to investigate this issue.

sebastianbergmann avatar Jun 07 '23 11:06 sebastianbergmann

I will investigate this, as I have to read up on v10 and the dependency checker is largely cooked up by me.

epdenouden avatar Jan 08 '24 16:01 epdenouden