[TIMOB-7644] iOS: Memory is not being released when a tab is removed from tabGroup
GitHub Issue | n/a |
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-06-27T12:16:54.000+0000 |
Affected Version/s | Release 1.8.1 |
Fix Version/s | Sprint 2012-04, Release 2.0.0, Release 2.1.0, Release 1.8.2 |
Components | iOS |
Labels | memory, module_tabgroup, qe-testadded, tab |
Reporter | Sandeep Bhimavarapu |
Assignee | Max Stepanov |
Created | 2012-02-14T10:08:01.000+0000 |
Updated | 2012-06-28T17:30:44.000+0000 |
Description
Memory is not being released when a tab is removed from a tabGroup on iOS using 'removeTab'.
*Sample Code*
{noformat}
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
// create base UI tab and root window
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
});
var tab1 = Titanium.UI.createTab({
icon:'KS_nav_views.png',
title:'Tab 1',
window:win1
});
var label1 = Titanium.UI.createLabel({
color:'#999',
text:'Remove Tab1',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto'
});
label1.addEventListener('click', function() {
tabGroup.removeTab(tab1);
label1 = win1 = tab1 = null;
});
win1.add(label1);
// create controls tab and root window
var win2 = Titanium.UI.createWindow({
title:'Tab 2',
backgroundColor:'#fff'
});
var tab2 = Titanium.UI.createTab({
icon:'KS_nav_ui.png',
title:'Tab 2',
window:win2
});
var label2 = Titanium.UI.createLabel({
color:'#999',
text:'I am Window 2',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto'
});
win2.add(label2);
// add tabs
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
// open tab group
tabGroup.open();
{noformat}
*STEPS TO REPRODUCE*
- Drop the above sample code into app.js.
- Start the application and open Instruments to profile it.
- Click the 'Remove Tab1' label.
- Search for 'proxy' in instruments and it can be seen that tab proxy(along with window and label proxies inside tab1) are not released even if memory warnings are simulated.
*EXPECTED BEHAVIOR*
Proxies related to tab and elements inside it should be released.
*OBSERVED BEHAVIOR*
Memory is not being freed.
Attachments
Please do not reopen resolved bugs if you need them in another branch.
Issue persists. Reproduction steps: 1. Launch code above 2. Click "Tab 2" 3. Click "Tab 1" 4. Click "Remove tab1" *PASS*: 1 of: TiUIWindowProxy, TiUITabProxy, TiUILabelProxy
Step #5: Click "Simulate Memory Warning"
Closing as Fixed. SDK: 2.0.0.v20120319003254 Studio: 2.0.0.201203182248 OS: Snow Leopard Devices Tested: iPhone4S 5.0.1 Attached Success Screenshot: Instruments Correct Screenshot.png
reopening/closing to add/remove labels
The memory is not being released for the objects: TiUIWindowProxy, TiUITabProxy, TiUILabelProxy Tested on SDK:2.1.0.v20120625134154 Tested on Studio:2.1.0.201206251749 Devices:iPad3(5.1), iphone 3GS(5.0.1) OS: OSX 10.7.3 This was working fine on 2.0.2
PR pending https://github.com/appcelerator/titanium_mobile/pull/2479
Fixed by PR 2479 on master and PR 2480 on 2_1_X
Closing issue: Tested with Ti Studio build 2.1.0.201206251749 Ti Mobile SDK 2.1.0.v20120627121617 hash r06667517 OSX Lion 10.7.3 iPhone 4S OS 5.0.1 Expected behavior is shown. Note it can take a few minutes on device for the living memory to drop to 1.