I’m running into an interesting problem. I’m using PHPUnit, and my tests take more memory every single time I run them. Ie…
2.25 MB
2.5 MB
3.0 MB
3.5 MB
…….
Does anyone know how to clear out the memory that is being consumed, and can anyone advise me on exploring this in depth? The immediate problem is that some of my larger tests are running out of memory, and simply continuing to increase the max memory allotment in PHP isn’t good enough…I need to know why a PHPUnit test running from command line would have memory usage which “sticks around” between runs.
Calvin, as per discussed in the chat, it was due to missing reset features.
When testing, we must ensure that the test environment is consistent so that we’re able to get accurate results. Computing is Input/Output and hence we should use Fixtures in PHPUnit to reset storage to prevent "memory leaks" like these.