Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23535] Android: Memory leak with Ti.UI.TabGroup

GitHub Issuen/a
TypeBug
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
Reportersai jayanth kumar pasupuleti
AssigneeYordan Banev
Created2016-06-13T06:26:07.000+0000
Updated2018-10-04T13:45:13.000+0000

Description

here my issue is, in TabGroups I have created four tabs and mapped four controllers to those tabs each. after navigating to any other controller im unable to clear heapmemory or unable to close opened controllers in four tabs I have check heap memory creation in ddms tool. It is crashing my android app. Test Code:
var allUserstories = Alloy.createController('allUserstories').getView();
var myUserstories = Alloy.createController('myUserstories').getView();
var confidenceReport = Alloy.createController('confidenceReport').getView();
var retrospectiveWn = Alloy.createController('retrospectiveWn').getView();

var tabGroup = Ti.UI.createTabGroup(
{ tabs : [tab1, tab2, tab3, tab4], smoothScrollOnTabClick : true, }

);

var tab1 = Ti.UI.createTab(
{ window : allUserstories, title : 'All Issues' }

),
tab2 = Ti.UI.createTab(
{ window : myUserstories, title : 'My Issues' }

),
tab3 = Ti.UI.createTab(
{ window : confidenceReport, title : 'Confidence Report' }

),
tab4 = Ti.UI.createTab(
{ window : retrospectiveWn, title : 'Retrospective' }

);
Once I navigate to any other controller like naxtController.js or back to previousController.js I have to destroy all these four tabs associated tab controllers. Where in each controller there consist's a lot of view and other UI objects created which need to garbage collected.

Comments

  1. Nazmus Salahin 2016-06-13

    Hello, Thanks for reaching out. To understand your problem better and give you a workaround we need to reproduce the issue in our environment. So it will be appreciated if you give us test code and mention step to reproduce. Please try to give simple test code that reproduces this issue. Thanks in advance
  2. sai jayanth kumar pasupuleti 2016-06-13

    var allUserstories = Alloy.createController('allUserstories').getView(); var myUserstories = Alloy.createController('myUserstories').getView(); var confidenceReport = Alloy.createController('confidenceReport').getView(); var retrospectiveWn = Alloy.createController('retrospectiveWn').getView(); var tabGroup = Ti.UI.createTabGroup({ tabs : [tab1, tab2, tab3, tab4], smoothScrollOnTabClick : true, }); var tab1 = Ti.UI.createTab({ window : allUserstories, title : 'All Issues' }), tab2 = Ti.UI.createTab({ window : myUserstories, title : 'My Issues' }), tab3 = Ti.UI.createTab({ window : confidenceReport, title : 'Confidence Report' }), tab4 = Ti.UI.createTab({ window : retrospectiveWn, title : 'Retrospective' }); // Once I navigate to any other controller like naxtController.js or back to previousController.js I have to destroy all these four tabs associated tab controllers. Where in each controller there consist's a lot of view and other UI objects created which need to garbage collected.
  3. sai jayanth kumar pasupuleti 2016-06-14

    By further debugging, I came to know when we are adding any UI components to the tab mapped controllers, Then it is causing memory leak even if after closing/destroy/ making null the UI components in each tab mapped controller. *Note:* When we keep a blank window mapped to a tab(without any UI components) then there is no memory leak issue.
  4. Sharif AbuDarda 2016-06-15

    Hello, The code that you provided is not sufficient enough. You need to provide the code that are in seperate controllers with the UI eliments that it has. Also, Its not there, how you are closing/destroy/ making null the UI components in each tab mapped controller. So, Please providde a full reproducible codes in seperate section with the indecated file name. We will try it in our environment. Also, please provide a full list of steps to follow. If we are able to regenerate the issue, we can ascalete the ticket for a fix. But. we need to test the issue. So, we need a full regeneratable code. Please provide your environment info. Regards, Sharif.
  5. sai jayanth kumar pasupuleti 2016-06-17

    Hi, I have given a sample android app, Please download it from the below link. https://drive.google.com/file/d/0B-FjGZ0vRJROTm01dnpIWVQtNFE/view?usp=sharing 1) Deploy app in your mobile with *android:debuggable="true"* in tiapp.xml . 2) Open DDMS tool and check heap memory for the app and note down occupied heap memory. 3) Once app is opened with home controller(1st controller) in your mobile click on *"Hello, World"* 4) Check Heap memory which will be changed, it is fine. 5) surf in the given tabs (controllers) with swiping from left to right. 6) Go back to the previous Home controller. 7) Now memory should be released and it must be equal to first noted heap memory size, But check heap memory in DDMS tool where you can find a memory increase/leak of 1 to 2 mb. In real scenario I have created lot many UI components dynamically from tab mapped controllers, which is creating a memory leak of 20mb from laving that tabgroup and navigating to other controllers.
  6. Sharif AbuDarda 2016-06-17

    Hello, I was able to follow your instructions and successfully regenerate the issue. 1. Open DDMS tool and checked heap memory (18.125M). 2. Clicking on "Hello, World", checked heap memory (19.37M). 3. Surfing in the given tabs, checked heap memory (20.4M). 4. Going back to previous Home controller, checked heap memory (23.5M). I see the issue is happening in Android device 4.4.2. I have tested with SDK 5.3.0.GA. Our engineering team will look into it for a fix. Moving the ticket. Regards, Sharif.
  7. sai jayanth kumar pasupuleti 2016-06-25

    Hi Chee Kiat Ng, Can I know the status update on this issue. Thanks. P Sai Jayanth Kumar.
  8. Frankie Merzadyan 2017-03-23

    [~saijayanth@vidyayug.com], Can you post a stack trace/log output for the crash?

JSON Source