Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    finalizepublic

    finalize

    Node module to register a garbage collector callback for objects

    Usage

    var finalize = require('finalize');
     
    var obj = { x: 1337 };
    finalize(obj, function () {
      console.log(this.x); // this will print '1337'
    });
    global.gc();
    // nothing will happen, var obj above holds obj alive
    obj = null;
    global.gc();
    // the previous line should trigger the callback above

    Keywords

    install

    npm i finalize

    Downloadsweekly downloads

    6

    version

    1.0.4

    license

    BSD-2-Clause

    repository

    githubgithub

    last publish

    collaborators

    • avatar