Giter Site home page Giter Site logo

Comments (3)

nielsdos avatar nielsdos commented on May 30, 2024 1

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.

nielsdos avatar nielsdos commented on May 30, 2024

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.

YuanchengJiang avatar YuanchengJiang commented on May 30, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.