Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ThomasLandauer
Copy link
Member

Fixes #6840

This line was introduced in 2013 by 558498e

Overriding what the user has in php.ini doesn't make sense to me.

Fixes Codeception#6840

This line was introduced in 2013 by Codeception@558498e

Overriding what the user has in `php.ini` doesn't make sense to me.
@W0rma
Copy link
Contributor

W0rma commented Dec 22, 2025

As already mentioned in #6840 (comment) the memory limit is not hard-coded but configurable as documented in https://codeception.com/docs/reference/Configuration#settings.


public function run(string $suite, ?string $test = null, ?array $config = null): void
{
ini_set('memory_limit', $this->config['settings']['memory_limit'] ?? '1024M');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ThomasLandauer Doesn't this PR make the config option memory_limit useless?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! Having an extra memory limit doesn't make sense to me. If I set 3G in php.ini, then I expect it to be 3G - and not overridden by some obscure setting buried somewhere ;-)
This is a leftover from the early days of Codeception - back in 2013, maybe nobody had tests that needed more than 1G.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are other code places which read $this->config['settings']['memory_limit'] as well. Is it intended that they are not touched by this PR?

I'm afraid changing the behavior of the memory_limit config option could be considered a BC break and thus would require a new major version.

Copy link
Member Author

@ThomasLandauer ThomasLandauer Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. No, that's not intended, but forgotten ;-) I just wanted to get some feedback first before investing more time...
  2. I'm certainly no SemVer expert! But as far as I understand it: When this limit is reached, Codeception crashes. At least, that's what I observed. So dropping the limit cannot break anything, but (at most) make something work.
    In any case: I didn't get a useful answer to Test runner sometimes just stops, sometimes gives "Allowed memory size exhausted" error #6840 in 10 months. And it was annoying to debug, cause it only affects large test suites, and you (obviously) always need to run them completely. => So IMO this would be worth even a new major version.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But as far as I understand it: When this limit is reached, Codeception crashes. At least, that's what I observed. So dropping the limit cannot break anything, but (at most) make something work.

Yes, Codeception might crash, but this could be considered a BC break because it would not have been crashed without this PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TavoNiievez WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So dropping the limit cannot break anything, but (at most) make something work.

I think this assumption is only true if the memory_limit in your php.ini is greater than the Codeception default of 1G. According to https://www.php.net/manual/en/ini.core.php#ini.memory-limit the default would be only 128M if you don't set anything explicitly in your php.ini, which would mean that if we don't adjust this in Codeceptino to 1G by default anymore, I'd expect tests to crash for at least some people where they ran fine before.

@ThomasLandauer
Copy link
Member Author

OK, I must admit that "hard-coded" isn't the right term ;-) It's rather something like a "hidden" limit...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test runner sometimes just stops, sometimes gives "Allowed memory size exhausted" error

3 participants