Skip to content

Zend: Fix leaks when destructors throw during shutdown#22020

Closed
LamentXU123 wants to merge 1 commit into
php:PHP-8.4from
LamentXU123:mem-leak-fix
Closed

Zend: Fix leaks when destructors throw during shutdown#22020
LamentXU123 wants to merge 1 commit into
php:PHP-8.4from
LamentXU123:mem-leak-fix

Conversation

@LamentXU123
Copy link
Copy Markdown
Contributor

@LamentXU123 LamentXU123 commented May 12, 2026

as per #22010, this is *probably* because if shutdown aborts, while unwinding from the thrown exception, the matching
GC_DELREF() / OBJ_RELEASE() calls may be skipped. That means, we need to add a catch logic to make sure that the object is released.

cc @arnaud-lb. See if this works :)

@LamentXU123 LamentXU123 marked this pull request as draft May 12, 2026 10:29
@LamentXU123 LamentXU123 changed the base branch from master to PHP-8.4 May 12, 2026 10:30
@LamentXU123 LamentXU123 marked this pull request as ready for review May 12, 2026 10:30
@arnaud-lb
Copy link
Copy Markdown
Member

Thank you @LamentXU123. Thinking more about it, I'm not sure we should fix this. It's probably better to avoid executing too much code after a bailout. This happens during shutdown, so the leak is going to resolve itself when the heap is reset.

@bwoebi
Copy link
Copy Markdown
Member

bwoebi commented May 12, 2026

Yes, we don't care about leaks in the bailout (CG(unclean_shutdown)) case.
There's nothing to fix here.

@bwoebi bwoebi closed this May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants