The Problem:
A window that has some type of animation with a callback function leaks.
Test case
Open instruments and look for proxies while opening and closing the window in the following code sample:
Code
function Window1(){
var self = {};
var win = Ti.UI.createWindow();
var btn = Ti.UI.createButton({
title:'open',
left:20,
right:20,
height:44
});
btn.addEventListener('click', function(){
Window2().open();
});
win.add(btn);
self.open = win.open;
self.close = win.close;
return self;
}
function Window2(){
var self = {};
var win = Ti.UI.createWindow({
backgroundColor:'green'
});
// win.addEventListener('close', function(){
// win = null; // this will make the window go away from memory, but not the items within
// });
win.addEventListener('open', function(){
win.animate({
left:10,
duration:300
}, function(){
Ti.API.info('complete');
});
});
var btn = Ti.UI.createButton({title:'close', left:20,right:20,height:44});
btn.addEventListener('click', function(){
win.close();
});
win.add(btn);
self.open = win.open;
self.close = win.close;
return self;
}
Window1().open();
Reopening to add labels and closing comment
Verified fixed with SDK 1.9.0.v20120121223134 on iPhone 4s (5.0.1).
updated labels
Reopening the ticket as it's leaking in 3.5.0 SDK While testing with Xcode instruments, # Persistent value never goes down. This is a *regression* as it's working fine in 3.4.1 release. Test Environment: Titanium SDK: 3.5.0.v20141202100219 Appc-Studio: 3.4.1 GA Titanium CLI: 3.4.1 GA Alloy : 1.5.1 GA Xcode : 6.1 OS: OSX 10.10.1 Device : iPhone 6plus (iOS 8.1)
Had seen the same issue. If the window has some type of animation with a callback function then its leaking. Without Animation, its work fine.
Pull pending master - https://github.com/appcelerator/titanium_mobile/pull/6488 3_5_X - https://github.com/appcelerator/titanium_mobile/pull/6489
CR and FT Passed. Both pull requests merged.
Verified the fix and hence closing the ticket. Test Environment: Titanium SDK: 3.5.0.v20141222103320 Appc-Studio: 3.4.1 GA Titanium CLI: 3.4.1 GA Alloy : 1.5.1 GA Xcode : 6.1 OS: OSX 10.10.1 Device : iPhone 6plus (iOS 8.1)