Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Unified Diff: appengine/config_service/ui/bower_components/async/perf/memory.js

Issue 2923973003: Added base template for config ui. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: appengine/config_service/ui/bower_components/async/perf/memory.js
diff --git a/appengine/config_service/ui/bower_components/async/perf/memory.js b/appengine/config_service/ui/bower_components/async/perf/memory.js
new file mode 100644
index 0000000000000000000000000000000000000000..1a022af3576c47adf42ab1e597c7d03b70e2c86f
--- /dev/null
+++ b/appengine/config_service/ui/bower_components/async/perf/memory.js
@@ -0,0 +1,46 @@
+if (process.execArgv[0] !== "--expose-gc") {
+ console.error("please run with node --expose-gc");
+ process.exit(1);
+}
+
+var async = require("../");
+global.gc();
+var startMem = process.memoryUsage().heapUsed;
+
+function waterfallTest(cb) {
+ var functions = [];
+
+ for(var i = 0; i < 10000; i++) {
+ functions.push(function leaky(next) {
+ function func1(cb) {return cb(); }
+
+ function func2(callback) {
+ if (true) {
+ callback();
+ //return next(); // Should be callback here.
+ }
+ }
+
+ function func3(cb) {return cb(); }
+
+ async.waterfall([
+ func1,
+ func2,
+ func3
+ ], next);
+ });
+ }
+
+ async.parallel(functions, cb);
+}
+
+function reportMemory() {
+ global.gc();
+ var increase = process.memoryUsage().heapUsed - startMem;
+ console.log("memory increase: " +
+ (+(increase / 1024).toPrecision(3)) + "kB");
+}
+
+waterfallTest(function () {
+ setTimeout(reportMemory, 0);
+});

Powered by Google App Engine
This is Rietveld 408576698