Comments (3)
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.
from php-src.
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:
- On SAPIs like Apache, other modules may use libxml as well. So we must be careful to reset the allocator back to the system allocator at request end such that other Apache modules don't use PHP's allocator.
- Even when using the request allocator, we cannot control what third party extensions, or libraries, allocate and how long they keep that data alive. E.g. a third party module could cache some data allocated by libxml longer than the duration of a request, which will cause problems.
from php-src.
@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.
from php-src.
Related Issues (20)
- Unable to load dynamic library 'mysqli' HOT 7
- `make test` Privacy Issues HOT 3
- Reflection: promoted constructor parameter has no default value HOT 2
- ZEND_MOD_CONFLICTS doesn't work
- Scalar Type Casting Magic Methods HOT 2
- openssl_dh_compute_key() silently fails for ECDH HOT 2
- Signed Integer Overflow in ext/date/lib/parse_posix.c
- Segmentation fault on unknown address 0x600000000018 in ext/opcache/jit/zend_jit.c HOT 2
- Heap hardening HOT 7
- mail() breaks quoted_printable_encode()d subject HOT 2
- Extend Reflection to expose import statements HOT 3
- For iterate over letters strange behavior HOT 6
- Regression - php.ini spelling mistake HOT 2
- curl segfault HOT 9
- heap-buffer-overflow with opcache when extending an internal class with class constant having attributes HOT 1
- Add SO_LINGER option for streams HOT 1
- pcntl_fork children are utilizing just a single core on FreeBSD 13.3+ HOT 5
- Set declare(strict_types=1) as Default Behavior
- Segmentation fault on unknown address 0x0001ffff8041 with XML extension under certain memory limit HOT 2
- Unpacking via list() produces NULLs in foreach HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-src.