mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00

As PHP has a minimum memory usage of 2M (size of allocator chunk),
setting a limit below that value is not meaningful and will be
automatically rounded up to the chunk size. Rather than doing this
silently, show the newly introduced error message.
The memory limit had to be increased to 2M for a number of tests.
tests/lang/bug45392 has been marked as XFAIL. This old bugfix is
not working as intended. The memory limit in main's `PG(memory_limit)`
differs from the one in zend_alloc. In zend_alloc the `AG(mm_heap)->limit`
is defined as `max(passed_value, ZEND_MM_CHUNK_SIZE)`. The check made in
an unclean shutdown will never be true unless the memory limit is lower
than ZEND_MM_CHUNK_SIZE, which happened to be the case in the test.
https://bugs.php.net/bug.php?id=45392
fcc0fdd125
29 lines
566 B
PHP
29 lines
566 B
PHP
--TEST--
|
|
Out of Memory in a nested fiber
|
|
--INI--
|
|
memory_limit=2M
|
|
--SKIPIF--
|
|
<?php
|
|
if (getenv("USE_ZEND_ALLOC") === "0") {
|
|
die("skip Zend MM disabled");
|
|
}
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
|
|
$fiber = new Fiber(function (): void {
|
|
$fiber = new Fiber(function (): void {
|
|
$buffer = '';
|
|
while (true) {
|
|
$buffer .= str_repeat('.', 1 << 10);
|
|
}
|
|
});
|
|
|
|
$fiber->start();
|
|
});
|
|
|
|
$fiber->start();
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %sout-of-memory-in-nested-fiber.php on line %d
|