sebastianbergmann/phpunit — Issue #402: Problem with memory_limit
Author: gboer
Created: 2011-11-11 09:20:05+00:00
State: open

I'm currently running into a memory_limit problem with PHPUnit. I've set my memory_limit for PHPUnit, using an XML-configuration file, to 256 MB. Now all the tests are run perfectly, until it tries to generate the code coverage report. It then reports that it exceeds the allowed memory size of 10MB.

In one of my tests, code is being tested that sets the memory_limit to 100MB and then back to whatever it was before. I use ini_get to determine what the memory limit was before I set it to 100MB, and that limit seems to be 10MB. Now I don't understand why it would be 10MB, since I can't find any configuration that actually specifies it to be 10MB, but regardless, that's not my real problem. The problem is that code coverage runs into that same 10MB problem, while I've set PHPUnit to use up to 256MB.

I could of course set the limit in my code to 256MB, regardless what it was before, but that means that my production code would also use 256MB. And that's something I of course don't want and nor do I should need to do something like that.

Does anyone have any idea how to solve this problem?