Skip to content
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

src: add check against non-weak BaseObjects at process exit #35490

Closed
wants to merge 2 commits into from

Commits on Oct 3, 2020

  1. src: add check against non-weak BaseObjects at process exit

    When a process exits cleanly, i.e. because the event loop ends up
    without things to wait for, the Node.js objects that are left on
    the heap should be:
    
     1. weak, i.e. ready for garbage collection once no longer
        referenced, or
     2. detached, i.e. scheduled for destruction once no longer
        referenced, or
     3. an unrefed libuv handle, i.e. does not keep the event loop
        alive, or
     4. an inactive libuv handle (essentially the same here)
    
    There are a few exceptions to this rule, but generally,
    if there are C++-backed Node.js objects on the heap
    that do not fall into the above categories, we may be looking
    at a potential memory leak. Most likely, the cause is a missing
    `MakeWeak()` call on the corresponding object.
    
    In order to avoid this kind of problem, we check the list
    of BaseObjects for these criteria. In this commit, we only do so
    when explicitly instructed to or when in debug mode
    (where --verify-base-objects is always-on).
    
    In particular, this avoids the kinds of memory leak issues
    that were fixed in the PRs referenced below.
    
    Refs: nodejs#35488
    Refs: nodejs#35487
    Refs: nodejs#35481
    addaleax committed Oct 3, 2020
    Copy the full SHA
    ade01e9 View commit details
    Browse the repository at this point in the history

Commits on Oct 4, 2020

  1. Copy the full SHA
    623ba9a View commit details
    Browse the repository at this point in the history