Fix generator memory leaks when interrupted during argument evaluation - #9756
Conversation
There was a problem hiding this comment.
This duplicates cleanup_unfinished_calls(). I will look into ways to factor this out in an other PR.
There was a problem hiding this comment.
Is it possible to simplify cleanup_unfinished_calls() in a way that it calls this function with a buffer, then frees all zvals on that buffer?
There was a problem hiding this comment.
8.0 calls D::__destructor: https://3v4l.org/32Ku7
8.1 does not because the constructor has not been called
dstogov
left a comment
There was a problem hiding this comment.
At first this looks terrible, but I don't see another solution and approve.
Actually, our "backup" GC started to walk over generators stacks, that made it similar to classic mark-and-sweep, but with higher overhead.
It would be interesting to see if this affects aerys performance.
Indeed. I've tried running https://github.com/dbalabka/aerys-benchmark, and I've seen no differences before and after this PR. |
* PHP-8.0: [ci skip] NEWS Fix generator memory leaks when interrupted during argument evaluation (#9756)
* PHP-8.1: [ci skip] NEWS [ci skip] NEWS Fix generator memory leaks when interrupted during argument evaluation (#9756)
* PHP-8.2: [ci skip] NEWS [ci skip] NEWS [ci skip] NEWS Fix generator memory leaks when interrupted during argument evaluation (#9756)
* PHP-8.0: [ci skip] NEWS Fix generator memory leaks when interrupted during argument evaluation (php#9756)
* PHP-8.1: [ci skip] NEWS [ci skip] NEWS Fix generator memory leaks when interrupted during argument evaluation (php#9756)
* PHP-8.2: [ci skip] NEWS [ci skip] NEWS [ci skip] NEWS Fix generator memory leaks when interrupted during argument evaluation (php#9756)
Fixes #9750