Last active
July 15, 2017 11:41
-
-
Save andywer/0f23eaa2a8b91db4bd2f1fcc51b69bf9 to your computer and use it in GitHub Desktop.
Leakage async: Real world test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"test": "mocha" | |
}, | |
"engines": { | |
"node": ">= 7.0" | |
}, | |
"devDependencies": { | |
"leakage": "./path/to/local/leakage/branch/feature/async-support", | |
"mocha": "^3.2.0", | |
"threads": "0.7.2" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Works well! Fails when using threads@0.7.1, but succeeds for threads@0.7.2 | |
* which includes a memory leak fix for `thread.promise()`. | |
* See https://github.com/andywer/threads.js/pull/32 | |
*/ | |
const { iterate } = require('leakage') | |
const { spawn } = require('threads') | |
describe('threads.js', () => { | |
it('does not leak', () => { | |
const thread = spawn() | |
return iterate(100, () => thread.run((input, done) => done()).send().promise()) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment