Skip to content

Instantly share code, notes, and snippets.

@avesus
Created August 28, 2015 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avesus/fc886290ccc4d52fd9e6 to your computer and use it in GitHub Desktop.
Save avesus/fc886290ccc4d52fd9e6 to your computer and use it in GitHub Desktop.
Node gc memoryUsage test
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