Last active
August 29, 2015 14:08
-
-
Save indianburger/7708085e9a7e57eea290 to your computer and use it in GitHub Desktop.
memory leaks
This file contains hidden or 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
<button id="start">Start</button> | |
<script> | |
var button = document.getElementById('start'); | |
var leaker = []; | |
button.addEventListener("click", function() { | |
for (var i = 0; i < 1000000; i++) { | |
leaker.push(document.createElement("div")); | |
} | |
}); | |
</script> |
This file contains hidden or 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
var browserPerf = require('browser-perf'); | |
var Q = require("Q"); | |
var url = process.argv[2]; | |
var options = { | |
selenium: 'http://localhost:9515', | |
browsers: [{ | |
browserName: 'chrome', | |
loggingPrefs: { | |
performance: 'ALL' | |
} | |
}], | |
actions: waitForRender.bind(null, url), | |
// metrics: [memoryMetric()] | |
}; | |
browserPerf(url, function(err, results) { | |
console.log(results); | |
}, options); | |
function waitForRender(url, browser) { | |
return browser.get(url) | |
.then(function() { | |
return browser.elementByCss("#start"); | |
}).then(function(el) { | |
return el.click(); | |
}).then(function() { | |
return browser.execute(":takeHeapSnapshot"); | |
}).then(function(snap) { | |
console.log("snap:", snap); | |
debugger; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment