Last active
December 17, 2015 06:48
-
-
Save felixge/5567854 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
git bisect start | |
git bisect bad v2.0.0-alpha8 | |
git bisect good v2.0.0-alpha7 | |
git bisect run node leak.js |
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
var mysql = require( './index' ); | |
var connection = mysql.createConnection({}); | |
var counter = 0; | |
var sql = 'SELECT 0'; | |
var start = Date.now(); | |
function query() { | |
var usage = process.memoryUsage().heapUsed / 1024 / 1024; | |
//console.log(usage); | |
var duration = Date.now()-start; | |
if (usage > 50) { | |
console.log('leak detected: memory usage > 50 MB, took: %d sec', duration/1000); | |
process.exit(1); | |
} | |
if (duration > 5000) { | |
console.log('no leak detected after 5 sec'); | |
process.exit(0); | |
} | |
connection.query(sql, function(err, rows) { | |
query(); | |
}); | |
}; | |
query(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment