{ "id": "90739", "key": "TIMOB-8858", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2012-05-07T11:18:36.000+0000", "created": "2012-04-23T08:20:43.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "SupportTeam", "core" ], "versions": [ { "id": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" } ], "issuelinks": [ { "id": "16813", "type": { "id": "10001", "name": "Cloners", "inward": "is cloned into", "outward": "is cloned from" }, "outwardIssue": { "id": "90738", "key": "TIMOB-8857", "fields": { "summary": "iOS: Destroying a parent object (setting it to null) it won't destroy any child objects", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-24T18:11:22.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "h6.Issue\r\n\"Destroying a parent object (setting it to null) will destroy any child objects as long as no other references to those child objects exist. Consider the following code snippet to get a feel for the specifics:\"\r\n\r\nh6.Tested on\r\nDroid Razr 2.3.5\r\n\r\nh6.Test Case 1\r\n\r\n{code}\r\nvar win = Titanium.UI.createWindow({\r\n\ttitle: 'Main',\r\n\texitOnClose: true,\r\n\tfullscreen: false,\r\n\tnavBarHidden: false,\r\n\tbackgroundColor: 'gray'\r\n});\r\n\r\nvar button = Ti.UI.createButton({\r\n // parameters go here...\r\n title: 'deletes the view and its proxy,\\nbut not the button!',\r\n backgroundColor: 'red'\r\n});\r\nvar view = Ti.UI.createView({\r\n // some parameters here...\r\n borderRadius:10,\r\n top: 15\r\n});\r\nview.add(button);\r\nwin.add(view); \r\nwin.addEventListener('click', function(){\r\n\t// ... later\r\n\twin.remove(view); // view & button still exist\r\n\tview = null; //deletes the view and its proxy, but not the button!\r\n});\r\n\r\nwin.open();\r\n{code}\r\n\r\n\r\nh6.So Having button set to null do get released (as seen in DDMS).\r\n\r\n\r\nh6.Test Case 2\r\n\r\n{code}\r\nvar win = Titanium.UI.createWindow({\r\n\ttitle: 'Main',\r\n\texitOnClose: true,\r\n\tfullscreen: false,\r\n\tnavBarHidden: false,\r\n\tbackgroundColor: 'gray'\r\n});\r\n\r\nvar button = Ti.UI.createButton({\r\n // parameters go here...\r\n title: 'deletes the view and its proxy,\\nbut not the button!',\r\n backgroundColor: 'red'\r\n});\r\nvar view = Ti.UI.createView({\r\n // some parameters here...\r\n borderRadius:10,\r\n top: 15\r\n});\r\nview.add(button);\r\nwin.add(view); \r\nwin.addEventListener('click', function(){\r\n\t// ... later\r\n\twin.remove(view); // view & button still exist\r\n\tview = null; // deletes the view and its proxy, but not the button!\r\n\tbutton = null;//do get released\r\n});\r\n\r\nwin.open();\r\n{code}\r\n\r\nh6.Additional info\r\nTest results and its corresponding screenshots:\r\n\r\nTestCase 1 - Button not being set > DDMS_Droid_2.1.0_TestCase1_a.jpg\r\nTestCase 1 - Button set to null > DDMS_Droid_2.1.0_TestCase1_b.jpg\r\n\r\nTestCase 2 - Button not being set > DDMS_Droid_2.1.0_TestCase2_a.jpg\r\nTestCase 2 - Button set to null > DDMS_Droid_2.1.0_TestCase2_b.jpg\r\n\r\nh6.Wiki Link\r\nhttps://wiki.appcelerator.org/display/guides/Managing+Memory+and+Finding+Leaks#ManagingMemoryandFindingLeaks-WhenTitaniumreleasesmemory", "attachment": [ { "id": "27340", "filename": "DDMS_Droid_2.1.0_TestCase1_a.jpg", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-04-23T08:24:39.000+0000", "size": 342975, "mimeType": "image/jpeg" }, { "id": "27341", "filename": "DDMS_Droid_2.1.0_TestCase1_b.jpg", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-04-23T08:24:39.000+0000", "size": 300615, "mimeType": "image/jpeg" }, { "id": "27342", "filename": "DDMS_Droid_2.1.0_TestCase2_a.jpg", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-04-23T08:24:39.000+0000", "size": 308246, "mimeType": "image/jpeg" }, { "id": "27343", "filename": "DDMS_Droid_2.1.0_TestCase2_b.jpg", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-04-23T08:24:39.000+0000", "size": 332120, "mimeType": "image/jpeg" } ], "flagged": false, "summary": "Android: Destroying a parent object (setting it to null) it won't destroy any child objects", "creator": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "environment": "Android: 2.3.5\r\nTitanium SDK: 2.1.0", "comment": { "comments": [ { "id": "193137", "author": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "body": "This issue is invalid. The reason why is actually called out in the description: \"Destroying a parent object (setting it to null) will destroy any child objects as long as no other references to those child objects exist. Consider the following code snippet to get a feel for the specifics:\"\r\n\r\nKey phrase here is: \"as long as no other references to those child objects exist\". \r\n\r\nA reference is anything that maintains a reference to the object (both the \"button\" variable and the view object keep their own references. Following that line of thought, setting view to null frees one of those references but there is still another (\"var button\").\r\n ", "updateAuthor": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "created": "2012-04-30T09:28:32.000+0000", "updated": "2012-04-30T09:28:32.000+0000" }, { "id": "193543", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Address key notes in: TIDOC-608", "updateAuthor": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-05-02T22:40:53.000+0000", "updated": "2012-05-02T22:40:53.000+0000" }, { "id": "415636", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as invalid with reference to the above comments.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-24T18:11:21.000+0000", "updated": "2017-03-24T18:11:21.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }