{ "id": "63248", "key": "TIMOB-2616", "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": [ { "id": "11244", "name": "Release 1.7.0", "archived": true, "released": true, "releaseDate": "2011-06-13" }, { "id": "11251", "name": "Sprint 2011-16", "archived": true, "released": true, "releaseDate": "2011-04-25" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-05-16T11:05:39.000+0000", "created": "2011-04-15T03:24:51.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "critical", "defect", "enterprise", "ios", "klist", "kroll", "leak", "memory", "release-1.7.0", "reported-1.5.1" ], "versions": [], "issuelinks": [], "assignee": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-05-16T11:05:39.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "{html}

KrollObject appears to retain itself twice within its own\nconstructor. This is an issue because quite often these objects are\nmeant to be autoreleased - they never will be, unless this is\nresolved.

\n

From #2299:

\n
\n

Bumping this down the road, with a note. It's two-pronged: Proxy\nretention issues (how we handle memory warnings is not smart right\nnow, because it LEADS to memory warnings) and problems in Kroll\ninvolving certain objects which should be autoreleased (but never\nare, because they're retained at very bad points in their\nlifecycle). Unfortunately at this time there's no good way to\nhandle clearing out stale client responses, simply because there's\nno good way to tell when they're \"stale.\"
\nThis bug should be a high priority target for a 1.5.1 release due\nto its critical nature.

\n
{html}", "attachment": [], "flagged": false, "summary": "KrollObject create problems", "creator": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "128986", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Pushing to 1.7 Kroll work. No milestone yet so tagging.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:24:52.000+0000", "updated": "2011-04-15T03:24:52.000+0000" }, { "id": "128987", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

removing release- tag as it's for committed code. Using\ntbs-1.7.0 to find items we know need to go in the next release.

{html}", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:24:52.000+0000", "updated": "2011-04-15T03:24:52.000+0000" }, { "id": "128988", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

A bunch of issues fixed along these lines.

{html}", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:24:53.000+0000", "updated": "2011-04-15T03:24:53.000+0000" }, { "id": "128989", "author": { "name": "rseagraves", "key": "rseagraves", "displayName": "Reggie Seagraves", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

There will be further changes to eliminate other memory leaks\nand we must insure that we do not regress on this issue.

{html}", "updateAuthor": { "name": "rseagraves", "key": "rseagraves", "displayName": "Reggie Seagraves", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:24:55.000+0000", "updated": "2011-04-15T03:24:55.000+0000" }, { "id": "128990", "author": { "name": "fspencer", "key": "fspencer", "displayName": "Fred Spencer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

This does not appear to be resolved. Though static proxies\n(absent of listeners) appear to be releasing, proxies that do have\nlisteners will not.

\n

Specific test cases can be provided once this issue is\nclarified.

{html}", "updateAuthor": { "name": "fspencer", "key": "fspencer", "displayName": "Fred Spencer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:24:56.000+0000", "updated": "2011-04-15T03:24:56.000+0000" }, { "id": "128991", "author": { "name": "rblalock", "key": "rblalock", "displayName": "Rick Blalock", "active": false, "timeZone": "America/Havana" }, "body": "{html}

Experiencing the same thing with a project as well. Allocations\ncontinue to build over time until the app inevitably crashes. This\nis even true with windows in separate javascript contexts (i.e. if\nyou're patient enough, going back and forth in a nav group in\nKitchen Sink will merit the same results). Another symptom seems to\nbe in a large tableview. If you scroll through 300-400 rows\nallocations will build up, then scroll back up, they will continue\nto build up, scroll back down, will continue to build up but never\nget released.

{html}", "updateAuthor": { "name": "rblalock", "key": "rblalock", "displayName": "Rick Blalock", "active": false, "timeZone": "America/Havana" }, "created": "2011-04-15T03:24:56.000+0000", "updated": "2011-04-15T03:24:56.000+0000" }, { "id": "128992", "author": { "name": "fspencer", "key": "fspencer", "displayName": "Fred Spencer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Test for recent changes:

\n

ATTEMPT 1: Memory is released, but event listeners\ndo not work consistently.

\n

ATTEMPT 2: Memory is released, but event listeners\ndo not work consistently.

\n

ATTEMPT 3: Event listeners work, but memory is not\nreleased.

\n
\n\nvar TestApp = (function() {\n    var API = {\n        App: {\n            run: null\n        },\n        SectionManager: null,\n        UI: null\n    };\n    \n    API.UI = {\n        win: Ti.UI.createWindow(),\n        button: Ti.UI.createButton({ left:10, top:10, right:10, height:30, title:'Reload Section' }),\n        items: []\n    };\n    \n    // used for @ATTEMPT 3\n    API.Controllers = {\n        addEventListener: function(params) {\n            params.obj.addEventListener(params.type, params.func);\n        }\n    };\n    \n    API.SectionManager = {\n        view: null,\n        generateSection: function(params) {\n            var sectionView = API.SectionManager.view = Ti.UI.createScrollView({ top:50, bottom:0, right:0, left:0, contentHeight:'auto', backgroundColor:'#ccc', layout:'horizontal', zIndex:0 });\n            var item = null;\n            \n            // EVENT HANDLER\n            function showAlert(e) {\n                alert('Tapped ' + e.source);\n            }\n            \n            API.UI.items = []; // clear this out\n            \n            for (var i = 0; i < 500; i++) {\n                item = Ti.UI.createImageView({ width:100, height:80, image:'image.png', left:10, right:10, top:10, bottom:10 });\n                API.UI.items.push(item); // used for @ATTEMPT 2\n                \n                // @ATTEPT 1 - ADDING EVENT LISTENER\n                // inconsistent\n                // item.addEventListener('click', showAlert);\n                \n                API.SectionManager.view.add(item);\n            }\n            \n            API.UI.win.add(API.SectionManager.view);\n\n            // @ATTEPT 2 - ADDING EVENT LISTENER\n            // inconsistent\n            // for (var o = 0, p = API.UI.items.length; o < p; o++) {\n            //  API.UI.items[o].addEventListener('click', showAlert);\n            // }\n            \n            // @ATTEPT 3 - ADDING EVENT LISTENER\n            // causes memory retain\n            for (var o = 0, p = API.UI.items.length; o < p; o++) {\n                API.Controllers.addEventListener({ obj:API.UI.items[o], type:'click', func:showAlert });\n            }\n        },\n        destroySection: function(params) {\n            API.UI.win.remove(API.SectionManager.view);\n            API.SectionManager.generateSection();\n        }\n    };\n    \n    API.App.run = function(params) {        \n        API.UI.button.addEventListener('click', function(e) {\n            API.SectionManager.destroySection();\n        });\n\n        API.UI.win.add(API.UI.button);\n        API.SectionManager.generateSection();\n        API.UI.win.open();\n    };\n    \n    return API;\n})();\n\n// run app\nTestApp.App.run();\n
{html}", "updateAuthor": { "name": "fspencer", "key": "fspencer", "displayName": "Fred Spencer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:24:56.000+0000", "updated": "2011-04-15T03:24:56.000+0000" }, { "id": "128993", "author": { "name": "rblalock", "key": "rblalock", "displayName": "Rick Blalock", "active": false, "timeZone": "America/Havana" }, "body": "{html}

I'm noticing the same with a customer's app. Event listeners do\nnot work in the ios_proxy_registration branch.

{html}", "updateAuthor": { "name": "rblalock", "key": "rblalock", "displayName": "Rick Blalock", "active": false, "timeZone": "America/Havana" }, "created": "2011-04-15T03:24:56.000+0000", "updated": "2011-04-15T03:24:56.000+0000" }, { "id": "128994", "author": { "name": "fspencer", "key": "fspencer", "displayName": "Fred Spencer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

This test is successful (based on attempt 2, above). Memory is\nbeing released and event listeners/handlers are working.

\n

Hoorah! :-)

\n

Adding event listeners using method attempt 1 remains\ninconsistent. Attempt 3 method retains. Awkward method,\nregardless.

\n

\nhttps://github.com/appcelerator/titanium_mobile/tree/ios_proxy_regi...
\ncommit: ee514a640ab1150f962f

\n

Performing additional tests on enterprise client projects.

\n
\nvar TestApp = (function() {\n    var API = {\n        App: {\n            run: null\n        },\n        SectionManager: null,\n        UI: null\n    };\n    \n    API.UI = {\n        win: Ti.UI.createWindow(),\n        button: Ti.UI.createButton({ left:10, top:10, right:10, height:30, title:'Reload Section' }),\n        items: [] // @SUCCESS - hold items\n    };\n        \n    API.SectionManager = {\n        view: null,\n        generateSection: function(params) {\n            var sectionView = API.SectionManager.view = Ti.UI.createScrollView({ top:50, bottom:0, right:0, left:0, contentHeight:'auto', backgroundColor:'#ccc', layout:'horizontal', zIndex:0 });\n            var item = null;\n            \n            // EVENT HANDLER\n            function showAlert(e) {\n                alert('Tapped ' + e.source);\n            }\n            \n            API.UI.items = []; // @SUCCESS - empty the array on rebuild\n            \n            for (var i = 0; i < 500; i++) {\n                item = Ti.UI.createImageView({ width:100, height:80, image:'image.png', left:10, right:10, top:10, bottom:10 });\n                API.UI.items.push(item); // @SUCCESS - push item to array\n                                \n                API.SectionManager.view.add(item);\n            }\n            \n            API.UI.win.add(API.SectionManager.view);\n\n            // @SUCCESS - ADDING EVENT LISTENER - cycle through array\n            for (var o = 0, p = API.UI.items.length; o < p; o++) {\n                API.UI.items[o].addEventListener('click', showAlert);\n            }\n        },\n        destroySection: function(params) {\n            API.UI.win.remove(API.SectionManager.view);\n            API.SectionManager.generateSection();\n        }\n    };\n    \n    API.App.run = function(params) {        \n        API.UI.button.addEventListener('click', function(e) {\n            API.SectionManager.destroySection();\n        });\n\n        API.UI.win.add(API.UI.button);\n        API.SectionManager.generateSection();\n        API.UI.win.open();\n    };\n    \n    return API;\n})();\n\n// run app\nTestApp.App.run();\n
{html}", "updateAuthor": { "name": "fspencer", "key": "fspencer", "displayName": "Fred Spencer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:24:57.000+0000", "updated": "2011-04-15T03:24:57.000+0000" }, { "id": "128995", "author": { "name": "rseagraves", "key": "rseagraves", "displayName": "Reggie Seagraves", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Blain, we have reports that this is still having problems.\nPlease fix and regress.

{html}", "updateAuthor": { "name": "rseagraves", "key": "rseagraves", "displayName": "Reggie Seagraves", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:24:57.000+0000", "updated": "2011-04-15T03:24:57.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }