Hi

A while ago I noticed that the current error messages when the memory_limit is reached / when an OOM condition is encountered are misleading, because PHP allocates memory from the operating systems in bulk in larger chunks and the size of the chunk is what is checked against the memory limit. However the error message reports the much smaller actual allocation, leading to confusion, because the last known memory usage + the reported allocation would be smaller than the memory limit.

I've created a PR to improve the error message to include all relevant sizes:

https://github.com/php/php-src/pull/11763

Unfortunately that PR did not get much discussion, much less a decision whether or not it makes the situation better.

I believe it does and thus I'm sending this email to solicit additional opinion. Please check the PR for additional information about the proposed rephrased message. You can see the example output from the adjusted tests.

Before merging the PR will likely require some cleanup and there are two different tests that fail in CI due to a different allocation path being hit compared to my local machine. Someone more knowledgeable will need to decide if the behavior is correct, especially since one of the outputs indicates an uint64 underflow (18446744073707454792) somewhere.

However I'd first like to gauge some opinions before spending more time on investigating that.

Best regards
Tim Düsterhus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to