-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak in xml extension #14044
Comments
Compilation errors create fatal errors, and fatal errors don't vall destructors because the program may be in an inconsistent state. Normally this doesn't cause leaks because objects and their backing data is allocated with the request allocator. Unfortunately, all extensions using libxml use the system allocator. When looking into whether it is possible to utilise the request allocator for libxml, there are a few problems:
|
@nielsdos Wondering if you developers would appreciate memory leak issues? I still have several such cases. Not sure how to determine if they are expected or known issues. I currently filter out similar leaks that happened in existing tests. |
We do appreciate reports for leaks. And thanks for the reports so far. You'll notice that when using ASAN and USE_ZEND_ALLOC=0 that things like fatal errors will cause leaks. In production code we use USE_ZEND_ALLOC=1 (also by default if unset) to enable Zend's own memory manager which cleans up memory after each request. So the leak for fatal errors doesn't actually happen for production code because the Zend engine cleans the memory and closes resources when its own allocator is used. This particular case is different because it also leaks under USE_ZEND_ALLOC=1 for the reason written in my previous comment. When you want to determine if a leak is a real leak, check if the leak reproduces under USE_ZEND_ALLOC=1. The engine will output a message saying it detected leaks when ran in debug mode (or ASAN will already complain if libraries are involved). If you encounter that, you can set USE_ZEND_ALLOC=0 to get a nice ASAN report. Also, a few tests have leaks that we know about, they are marked with XLEAK. Sometimes they are caused by issues in libraries we use, or by a known bug. |
Description
The following code:
Resulted in this output:
PHP Version
PHP 8.4.0-dev
Operating System
ubuntu 22.04
The text was updated successfully, but these errors were encountered: