{ "id": "61722", "key": "TIMOB-1090", "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": "11224", "name": "Release 1.4.0", "archived": true, "released": true, "releaseDate": "2010-07-16" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:55:10.000+0000", "created": "2011-04-15T02:43:48.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "ios", "iphone", "memory", "usage", "views" ], "versions": [], "issuelinks": [], "assignee": { "name": "rseagraves", "key": "rseagraves", "displayName": "Reggie Seagraves", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T01:55:10.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}

A customer has created a slide show type of application and on a\ndevice is reporting that after view 4-5 images, the app will become\nunresponsive and crash.

\n

View this ticket for reference:
\nhttp://helpdesk.appcelerator.net/tickets/2782

{html}", "attachment": [], "flagged": false, "summary": "Memory Usage on ImageViews", "creator": { "name": "ctredway1", "key": "ctredway1", "displayName": "ctredway", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "ctredway1", "key": "ctredway1", "displayName": "ctredway", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "124820", "author": { "name": "ctredway1", "key": "ctredway1", "displayName": "ctredway", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

from the customer:

\n

It also looks like TiUIImageView is never being deleted - they\njust persist in memory - I put a log into TiUIImageView::dealloc,\nand this is never called, despite removing the item from the window\nthat it was added to and unsetting all references to it.

\n

Looks like there is a problem.

\n

-(void)dealloc { NSLog ( @\"TiUIImageView::dealloc %@\", [NSDate\ndate] );
\nif (timer!=nil)
\n{ [timer invalidate]; } (timer); (images); (container); (previous);\n(urlRequest); [super dealloc]; }

{html}", "updateAuthor": { "name": "ctredway1", "key": "ctredway1", "displayName": "ctredway", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:43:49.000+0000", "updated": "2011-04-15T02:43:49.000+0000" }, { "id": "124821", "author": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [1177e7b3e90095d2ea40e818e26d178f14149e78])\n[#1090 state:resolved] fixed major memory leak\nissue on iphone \nhttp://github.com/appcelerator/titanium_mobile/commit/1177e7b3e9009...

{html}", "updateAuthor": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:43:49.000+0000", "updated": "2011-04-15T02:43:49.000+0000" }, { "id": "124822", "author": { "name": "davidr.", "key": "davidr.", "displayName": "David R.", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

I'm still experiencing memory leaks with 1.3.3. After 4-5\nImageViews loading JPEG of about 800K the app crashes (no memory).\nI tried setting the ImageView.image to null, ImageView to null.

{html}", "updateAuthor": { "name": "davidr.", "key": "davidr.", "displayName": "David R.", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:43:50.000+0000", "updated": "2011-04-15T02:43:50.000+0000" }, { "id": "124823", "author": { "name": "davidr.", "key": "davidr.", "displayName": "David R.", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

While reminding myself :-) that Apple states \"You should avoid\ncreating UIImage objects there are greater than 1024x1024 in size.\"\n(http://bit.ly/ahftC2), I've\nrun some tests and I was able to reproduce the crash.

\n

It happens when loading many ImageView instances (each with its\nown image) into the application. The memory quickly goes down until\nthe app crashes. Best practice shall be then to use fewer ImageView\n(and smaller images), I believe.

\n

Thanks Jeff for the good work you're doing here.

\n

This is the test the makes the app crash (you need one/some\nimages in your Resources folder)

\n
\nvar win = Ti.UI.currentWindow;\nvar memoryLabel = Ti.UI.createLabel({\n  text:Ti.Platform.availableMemory,\n  top:-20,\n  left:0,\n  font:{fontSize:22},\n  zIndex:-1\n});\nvar availMemoryLabel = Ti.UI.createLabel({\n  text:Ti.Platform.availableMemory,\n  top:20,\n  left:0,\n  font:{fontSize:22},\n  zIndex:-1\n});\nvar testStatusLabel = Ti.UI.createLabel({\n  text:'status',\n  top:-100,\n  left:0,\n  font:{fontSize:22},\n  zIndex:-1\n});
\n
\n\n\n
\nvar imageCounter=1;\nvar imageView=[];\nimageView[0] = Ti.UI.createImageView({\n width:'auto',\n height:'auto'\n});
\n
\n\n\n
\nvar loaded = function()\n{\n if ((imageCounter++)>=67) return;\n testStatusLabel.text=imageCounter+'/67';\n imageView[imageCounter-1] = Ti.UI.createImageView({
\n
\n\n\n
\n
\n
\nwidth:'auto',\nheight:'auto'\n
\n
\n\n\n
\n });\n win.add(imageView[imageCounter-1]);\n imageView[imageCounter-1].addEventListener('load',loaded);\n imageView[imageCounter-1].image='images/'+imageCounter+'.jpg';
\n};\nimageView[0].addEventListener('load',loaded);\n\n
\nwin.add(imageView[0]);\nwin.add(memoryLabel);\nwin.add(availMemoryLabel);\nwin.add(testStatusLabel);\n\n
\nwin.addEventListener('open',function(){\n memoryLabel.text=Ti.Platform.availableMemory;\n setInterval(function(){availMemoryLabel.text=Ti.Platform.availableMemory;},1000)\n imageView[0].image='images/'+imageCounter+'.jpg'; \n});\n
{html}", "updateAuthor": { "name": "davidr.", "key": "davidr.", "displayName": "David R.", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:43:50.000+0000", "updated": "2011-04-15T02:43:50.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }