Created
September 6, 2020 13:18
-
-
Save SET001/2ea8f08349565ccfe36c65ea5b45d06d to your computer and use it in GitHub Desktop.
eat all memory in node.js
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
const chunkSize = 1000 | |
const bufs = [] | |
try { | |
do { | |
bufs.push(Buffer.alloc(chunkSize * 1024 * 1024, 'x')) | |
} while (true) | |
} catch (e) { | |
console.log('stopping and ', Math.round(process.memoryUsage().rss / (1024 * 1024))) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment