trigger GC before memory limit is exhausted

From: Date: Fri, 15 May 2015 23:14:26 +0000
Subject: trigger GC before memory limit is exhausted
Groups: php.internals 
Request: Send a blank email to internals+get-86239@lists.php.net to get a copy of this message
Hello internals, today I have been pointed to bug #60982[1], which appears to be an unpleasant limitation. I wonder why the GC is not triggered when the memory limit is exhausted, what would avoid the script to end prematurely if there are uncollected cycles. I've tried out a (maybe too simplistic) solution[2], and with that modification the test script of bug #69639[3] would run, as well as Dan Ackroyd's memTest.php[4] presented in the other bug report. With my limited knowledge of C, systems programming, and the Zend Engine in particular, I can't see any drawbacks with this modification, so I would be happy if more experienced programmers could point out crucial issues. Otherwise it might be worthwhile to investigate further improvements (I have not tackled zend_mm_realloc_heap() or even "Out of memory" conditions). [1] <https://bugs.php.net/bug.php?id=60982> [2] <https://github.com/cmb69/php-src/tree/gc> [3] <https://bugs.php.net/bug.php?id=69639> [4] <https://gist.github.com/Danack/69323606f144a2bbb9db> -- Christoph M. Becker

« previous php.internals (#86239) next »