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

Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/Codeception/Codecept.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,6 @@ private function registerReporters(): void

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.


$config = Configuration::suiteSettings($suite, $config ?: Configuration::config());
$selectedEnvironments = $this->options['env'];

Expand Down
Loading