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

Leak checker #8687

Closed
wants to merge 5 commits into from
Closed

Leak checker #8687

wants to merge 5 commits into from

Commits on May 28, 2019

  1. embind: Attach finalizers to class handles if FinalizationGroup is av…

    …ailable
    
    FinalizationGroup is part of the WeakRef proposal for JavaScript, which
    is currently in "stage 2" of the standardization process:
    
      https://github.com/tc39/proposal-weakrefs
    
    This patch modifies Embind to automatically attach JS finalizers that
    will drop references to C++ objects held by JavaScript objects when
    those objects go away, and invoke destructors if a C++ object is no
    longer held by JS at all.
    
    Currently the only browser that implements the WeakRef proposal is
    Chromium in Git.  To run it with weak refs, run as:
    
      ./chrome --js-flags=--harmony-weak-refs
    
    (runDestructor): Modify to take $$ pointer as arg, instead of wrapper
    handle.  This is needed because we register a finalizer on the wrapper,
    but when the finalizer runs we don't have the wrapper any more: just the
    $$ pointer.
    (releaseClassHandle): Factor out this piece from ClassHandle_delete,
    implementing the guts of what's needed by a finalizer.
    (finalizationGroup, removeFinalizer, attachFinalizer): Add
    implementation of finalizers.
    (ClassHandle.delete): Remove finalizer when invoked explicitly.
    (makeClassHandle, ClassHandle.clone, ClassHandle.__construct): Register
    finalizers on wrappers, using the $$ pointer as the handle given the the
    finalizer and the key to unregister the object with the
    FinalizationGroup.
    wingo committed May 28, 2019
    Copy the full SHA
    f4aa51c View commit details
    Browse the repository at this point in the history
  2. Add myself to AUTHORS

    wingo committed May 28, 2019
    Copy the full SHA
    9addad0 View commit details
    Browse the repository at this point in the history
  3. Remove use of ES6 in embind.js

    wingo committed May 28, 2019
    Copy the full SHA
    4aaba2f View commit details
    Browse the repository at this point in the history
  4. Address review feedback

    wingo committed May 28, 2019
    Copy the full SHA
    c592fac View commit details
    Browse the repository at this point in the history
  5. Add -s EMBIND_LEAKCHECK=1 support

    * src/embind/embind.js: If the user passes -s EMBIND_LEAKCHECK=1, warn
      instead of silently calling an object's destructor if it becomes
      collectable but wasn't explicitly destroy()'d by the user.
    * src/settings.js: Add EMBIND_LEAKCHECK=1 variable.
    wingo committed May 28, 2019
    Copy the full SHA
    4690756 View commit details
    Browse the repository at this point in the history