Created
August 28, 2015 15:21
-
-
Save avesus/fc886290ccc4d52fd9e6 to your computer and use it in GitHub Desktop.
Node gc memoryUsage 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
console.log(process.memoryUsage()); | |
global.gc(); | |
var a = { | |
m: new Uint8Array(100000000) | |
}; | |
var b = { | |
m: new Uint8Array(100000000) | |
}; | |
a.b = b; | |
b.a = a; | |
for (var i = 0; i < 100000000; ++i) { | |
a.m[i] = 0; | |
b.m[i] = 0; | |
} | |
global.gc(); | |
console.log(process.memoryUsage()); | |
global.gc(); | |
a = null; | |
b = null; | |
global.gc(); | |
console.log(process.memoryUsage()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment