-
-
Save neuro-sys/cf6a7724b5f4c2257a19e67d6eb1c44a to your computer and use it in GitHub Desktop.
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
let buffer = ''; | |
for (let i = 0; i < 1e6 * 512; i++) { | |
buffer += String.fromCharCode(65 + Math.floor(Math.random() * 26)); | |
if (i % 1e6 === 0) { | |
console.log(Math.floor(process.memoryUsage().heapUsed / 1024 / 1024), 'MB heap is used'); | |
} | |
} |
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
$ node --max-old-space-size=128 index.js | |
4 'MB heap is used' | |
44 'MB heap is used' | |
81 'MB heap is used' | |
120 'MB heap is used' | |
159 'MB heap is used' | |
197 'MB heap is used' | |
235 'MB heap is used' | |
273 'MB heap is used' | |
311 'MB heap is used' | |
349 'MB heap is used' | |
387 'MB heap is used' | |
425 'MB heap is used' | |
463 'MB heap is used' | |
501 'MB heap is used' | |
539 'MB heap is used' | |
577 'MB heap is used' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment