# OOM error messages

- Thread: https://externals.io/message/121436
- Original archive: https://news-web.php.net/php.internals/121436
- Started by tim@bastelstu.be on 2023-10-19T18:55:01+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #121436 — tim@bastelstu.be — 2023-10-19T18:55:01+00:00

URL: https://externals.io/message/121436#121436

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
