Hi Florian!
in this PR[1] it got mentioned that it could be beneficial to add a
userland function that tells you how much memory there is still available
for you to allocate.
I am writing to ask for your opinion on this, because technically it should
be doable with a few lines of user land code (see the change in the PR, at
least for Linux). Nevertheless it could be nice to have such a function
telling you how much memory there is left before the inevitable.
I really don't know if that would be beneficial to any other case than
these tests, but maybe there are some opinions here.
I have some doubts that a general function would be useful; after all,
in most environments you are likely constrained by memory_limit. And I
don't see an advantage implementing it in C, unless there would be any
portable C API yielding the result.
However, it seems to be a good idea to make that function available for
re-use in the test suite, but I'm not sure where to put it, so that
extensions build with phpize could use it, too. Probably I'm thinking
too big here, and it would be good enough to add a file to tests/ or
/ext/standard/tests/.
Cheers,
Christoph