{ "id": "62211", "key": "TIMOB-1579", "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": "11225", "name": "Release 1.5.0", "archived": true, "released": true, "releaseDate": "2010-12-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:56:34.000+0000", "created": "2011-04-15T02:56:34.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "android", "defect", "dom", "memory", "xml" ], "versions": [], "issuelinks": [], "assignee": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T01:56:34.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": "{html}

I've been hitting terrible out-of-memory errors while working on\nour StatusNet Mobile client app on Android. On some investigation,\nit seems that the XML-related code is leaking a lot of memory:

\n

The caching code in NodeProxy.getProxy() says:

\n
\n// We cache node proxies so we're not constructing new ones on every single call\n// on node finalize we have to go back through and remove each proxy\n
\n

but I don't see any finalizer on NodeProxy and friends.

\n

Dumping the proxy objects into an ever-growing HashMap means\nthat DOM-related objects never get garbage collected once they've\nbeen accessed from JS code: both the proxy and the native object\nare always referenced from the HashMap.

\n

Simply removing the addition of proxy objects into that\nproxyCache hash map makes my app's memory usage MUCH more stable.\nIf the cache is necessary, weaker references should probably be\nused to ensure that the garbage collector can release the proxy\nobjects.

{html}", "attachment": [], "flagged": false, "summary": "Memory leak: XML DOM NodeProxy never releases proxy objects from cache on Android", "creator": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "126105", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

After discussion, we've decided to remove the cache altogether.\nIf the Ti developer wants to cache a node he/she can. iPhone impl\ndoesn't seem to be preserving identity either so this should not be\nan issue.

{html}", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:56:35.000+0000", "updated": "2011-04-15T02:56:35.000+0000" }, { "id": "126106", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [8c4255ae53929d6007537ea6d2275444e19e98fa])\n[#1579 state:fixed-in-qa] completely removed the\nNode cache. To test you should be able to process several xml\ndocuments and see memory eventually GC. The original implementation\nhad the cache as static so it would grow w/o bound and never clean\nwith each XML document processed. Thanks to Brion Vibber (https://appcelerator.lighthouseapp.com/users/100533)\nfor the original find \nhttp://github.com/appcelerator/titanium_mobile/commit/8c4255ae53929...

{html}", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:56:35.000+0000", "updated": "2011-04-15T02:56:35.000+0000" }, { "id": "126107", "author": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

loaded a few xml docs, and saw the GC kick in
\nfreed X objects / X bytes in Xms

\n

closing as resolved.

{html}", "updateAuthor": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:56:36.000+0000", "updated": "2011-04-15T02:56:36.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }