Created
October 6, 2011 23:27
-
-
Save dawsontoth/1268996 to your computer and use it in GitHub Desktop.
This test exhibits a memory leak interaction between setting table data and the http network client.
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 win = Ti.UI.createWindow({ | |
backgroundColor: '#fff' | |
}); | |
var table = Ti.UI.createTableView({ | |
bottom: 50 | |
}); | |
win.add(table); | |
var startTime = new Date().getTime(), startMemory = Ti.Platform.availableMemory; | |
var status = Ti.UI.createLabel({ | |
bottom: 0, height: 50, | |
textAlign: 'center', color: '#fff', backgroundColor: '#000' | |
}); | |
win.add(status); | |
setInterval(function () { | |
var data = []; | |
for (var i = 0; i < 500; i++) { | |
data.push({ hasChild: true, title: 'Row ' + i, leftImage: 'bug.png' }); | |
} | |
table.setData(data); | |
status.text = Math.round(Ti.Platform.availableMemory) + 'mb free, ' | |
+ Math.round(Ti.Platform.availableMemory - startMemory) + 'mb net, ' | |
+ Math.round((new Date().getTime() - startTime) / 1000) + 's elapsed' | |
}, 100); | |
win.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment