{ "id": "84524", "key": "TIMOB-7051", "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": "12094", "description": "", "name": "Sprint 2012-02", "archived": true, "released": true, "releaseDate": "2012-01-29" }, { "id": "12593", "name": "Release 2.0.0", "archived": false, "released": true, "releaseDate": "2012-03-30" }, { "id": "12677", "description": "Release 1.8 Service Pack 1", "name": "Release 1.8.1", "archived": true, "released": true, "releaseDate": "2012-01-31" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-02-22T18:40:06.000+0000", "created": "2012-01-06T08:08:06.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "module_imageview", "qe-testadded", "regression" ], "versions": [ { "id": "12580", "description": "Dual Runtime 1.8.0", "name": "Release 1.8.0.1", "archived": true, "released": true, "releaseDate": "2011-12-22" } ], "issuelinks": [ { "id": "14501", "type": { "id": "10020", "name": "Depends", "inward": "is dependent of", "outward": "depends on" }, "inwardIssue": { "id": "84719", "key": "TIDOC-36", "fields": { "summary": "APIDoc: UI.ImageView rewrite including to correct example that uses deprecated url property", "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": "Medium", "id": "3" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "15359", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "86560", "key": "TIMOB-7681", "fields": { "summary": "iOS: hires property not respected for remote imageviews", "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": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-02-22T18:40:06.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": "h2. Problem\r\n\r\nI have an ImageView, clicking on the right, i want to change its image to the next image, clicking to the left, to the previous image, for browsing 50 images.\r\n\r\nChanging the {{image}} property of the imageView causes a memory leak which never recovers when using 1.8.0.1.\r\n\r\nNote that there is no memory leak when using 1.7.5.\r\n\r\n\r\nh2. Test case\r\n\r\n{code:lang=javascript|title=app.js}\r\n(function(){ \r\n\tvar screenWidth = Ti.Platform.displayCaps.platformWidth; \r\n\tTi.UI.setBackgroundColor('#000'); \r\n\t\r\n\tvar win = Ti.UI.createWindow({ \r\n\t\tbackgroundColor:'#000000', \r\n\t\tfullscreen: true \r\n\t}); \r\n\t\r\n\twin.open(); \r\n\t\r\n\tvar currentImage=1; \r\n\tvar max = 20; \r\n\t\r\n\tvar myImageView = Ti.UI.createImageView({ \r\n\t\timage: 'img/'+currentImage+'.jpg', \r\n\t\ttouchEnabled:false \r\n\t}); \r\n\twin.add(myImageView); \r\n\t\r\n\tfunction setImage(view, image){ \r\n\t\tview.image = 'img/'+image+'.jpg'; \r\n\t} \r\n\t\r\n\twin.addEventListener('click', function(e){ \r\n\t\tif(e.x > (screenWidth/2)){ \r\n\t\tcurrentImage++; \r\n\t\tif (currentImage>max) { \r\n\t\tcurrentImage=1; \r\n\t\t} \r\n\t\t} else { \r\n\t\tcurrentImage--; \r\n\t\tif(currentImage<1){ \r\n\t\tcurrentImage=max; \r\n\t\t} \r\n\t\t} \r\n\t\t\r\n\t\tsetImage(win.children[0], currentImage); \r\n\t\t\r\n\t\tTi.API.info(\"memory = \"+Ti.Platform.availableMemory); \r\n\t}); \r\n\t\r\n\tsetInterval(function() {\r\n\t\twin.fireEvent('click');\r\n\t}, 100);\r\n})(); \r\n{code}\r\n\r\nh2. Logs\r\n\r\n{code:lang=none|title=console using 1.8.0.1}\r\n[INFO] One moment, building ...\r\n[INFO] Titanium SDK version: 1.8.0.1 (12/22/11 13:09 fbdc96f)\r\n[INFO] iPhone Device family: universal\r\n[INFO] iPhone SDK version: 5.0\r\n[INFO] iPhone simulated device: iphone\r\n[INFO] Performing full rebuild. This will take a little bit. Hold tight...\r\n[INFO] Skipping JS compile, running from simulator\r\n[INFO] Performing clean build\r\n[INFO] Launching application in Simulator\r\n[INFO] Launched application in Simulator (11.92 seconds)\r\n[INFO] Found 5.0 patch installed\r\n[INFO] Application started\r\n[INFO] ImageViewTest/1.0 (1.8.0.1.fbdc96f)\r\n[INFO] memory = 3222.25\r\n[INFO] memory = 3208.1328125\r\n[INFO] memory = 3196.17578125\r\n[INFO] memory = 3184.48828125\r\n[INFO] memory = 3172.92578125\r\n[INFO] memory = 3159.390625\r\n[INFO] memory = 3145.64453125\r\n[INFO] memory = 3133.76171875\r\n[INFO] memory = 3125.4140625\r\n[INFO] memory = 3124.609375\r\n[INFO] memory = 3112.7421875\r\n[INFO] memory = 3100.7890625\r\n[INFO] memory = 3089.1484375\r\n[INFO] memory = 3074.5859375\r\n[INFO] memory = 3062.8671875\r\n[INFO] memory = 3050.9921875\r\n[INFO] memory = 3039.40625\r\n[INFO] memory = 3027.44921875\r\n[INFO] memory = 3015.515625\r\n[INFO] memory = 3000.921875\r\n[INFO] memory = 3000.96875\r\n{code}\r\n\r\n{code:lang=none|title=console using 1.7.5}\r\n[INFO] One moment, building ...\r\n[INFO] Titanium SDK version: 1.7.5\r\n[INFO] iPhone Device family: universal\r\n[INFO] iPhone SDK version: 5.0\r\n[INFO] iPhone simulated device: iphone\r\n[INFO] Performing full rebuild. This will take a little bit. Hold tight...\r\n[INFO] Skipping JS compile, running from simulator\r\n[INFO] Performing clean build\r\n[INFO] Launching application in Simulator\r\n[INFO] Launched application in Simulator (12.99 seconds)\r\n[INFO] Found 5.0 patch installed\r\n[INFO] Application started\r\n[INFO] ImageViewTest/1.0 (1.7.5.ab20af7)\r\n[INFO] memory = 3165.79296875\r\n[INFO] memory = 3153.82421875\r\n[INFO] memory = 3154.390625\r\n[INFO] memory = 3154.45703125\r\n[INFO] memory = 3154.53515625\r\n[INFO] memory = 3154.6015625\r\n[INFO] memory = 3154.66015625\r\n[INFO] memory = 3152.76953125\r\n[INFO] memory = 3152.890625\r\n[INFO] memory = 3152.98046875\r\n[INFO] memory = 3153.0703125\r\n[INFO] memory = 3157.1953125\r\n{code}\r\n\r\nh2. Workaround\r\n\r\nAlthough it's depreciated, using the {{url}} instead of {{image}} property resolves the issue.\r\n\r\nh2. Discussions\r\n\r\nQ&A: [changing image of an imageview does not free memory|http://developer.appcelerator.com/question/130317/changing-image-of-an-imageview-does-not-free-memory]", "attachment": [ { "id": "24952", "filename": "ImageViewTest.zip", "author": { "name": "cecileadam", "key": "cecileadam", "displayName": "Cécile Adam", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-06T08:08:06.000+0000", "size": 1623750, "mimeType": "application/zip" } ], "flagged": false, "summary": "iOS: UI.imageView - changing image property results in memory leak", "creator": { "name": "cecileadam", "key": "cecileadam", "displayName": "Cécile Adam", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "cecileadam", "key": "cecileadam", "displayName": "Cécile Adam", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "* Titanium SDK version: 1.8.0.1.fbdc96f\r\n* iOS 5.0\r\n* iPad simulator 5.0\r\n* OSX 10.7\r\n* Titanium Studio 1.0.7.201112281340", "comment": { "comments": [ { "id": "178357", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Thanks for raising this ticket.\r\n\r\nIn order for me to escalate it to the core team, all the fields must be complete. Please check it against the [JIRA Ticket Checklist|https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report#HowtoSubmitaBugReport-JIRATicketChecklist], and add any missing information. For the description, you can use [this template|https://wiki.appcelerator.org/display/guides/JIRA+Ticket+Template] as a starting point.\r\n\r\nFurthermore, a test case must be included in the body of the ticket and run without modification, as per the [Creating a Test Case|https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report#HowtoSubmitaBugReport-CreatingaTestCase] section.\r\n\r\nLastly, please provide the link to the Q&A, where you asked the community about this issue. This is a pre-requisite to raising tickets.\r\n\r\nThanks in advance for your cooperation.\r\n\r\n", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2012-01-06T10:26:24.000+0000", "updated": "2012-01-06T10:26:24.000+0000" }, { "id": "178364", "author": { "name": "cecileadam", "key": "cecileadam", "displayName": "Cécile Adam", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Thanks, I made the changes you asked. Hope I did it well, I a newbie with JIRA :-(", "updateAuthor": { "name": "cecileadam", "key": "cecileadam", "displayName": "Cécile Adam", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-06T10:48:08.000+0000", "updated": "2012-01-06T10:48:08.000+0000" }, { "id": "178391", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Almost there, Cecile - I don't think it runs in its current form though.\r\n\r\nI have a strong suspicion that this issue is not a bug, but the approach you have used. It's crucial that you remove all references to any objects (although particularly Titanium objects) as soon as they are no longer needed, in order for them to be garbage-collected. See [Garbage Collection by Reference Counting|http://docstore.mik.ua/orelly/webprog/jscript/ch11_03.htm#jscript4-CHP-11-SECT-3.2] for an explanation of the problem in layman's terms and Rick Blalock's informative [Your Apps are Leaking – Controlling Memory Leaks|http://vimeopro.com/appcelerator/codestrong-2011/video/29804284].\r\n\r\n", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2012-01-06T13:23:02.000+0000", "updated": "2012-01-06T13:23:02.000+0000" }, { "id": "178444", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Cecile\r\n\r\nAlthough the above references will be useful, I have now reproduced your issue with a simpler test case. I will let you know my findings next week.\r\n\r\nThanks", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2012-01-06T21:32:38.000+0000", "updated": "2012-01-06T21:32:38.000+0000" }, { "id": "178465", "author": { "name": "cecileadam", "key": "cecileadam", "displayName": "Cécile Adam", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Found something perhaps interesting !\r\n\r\nif I set the image with the url property instead of the image property it's OK !!!\r\n(ie myImageView.url instead of myImageView.image)\r\n\r\nBut, as it's deprecated, would prefer another solution !\r\n\r\nThanks", "updateAuthor": { "name": "cecileadam", "key": "cecileadam", "displayName": "Cécile Adam", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-08T08:14:52.000+0000", "updated": "2012-01-08T08:14:52.000+0000" }, { "id": "178627", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "I have tested this and can confirm that the behavior is as described. Escalating now.", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2012-01-10T03:56:27.000+0000", "updated": "2012-01-10T03:56:27.000+0000" }, { "id": "179441", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "There is a good chance this is not a memory leak. For performance (and memory usage for multiple-loaded image) reasons, we cache images in memory when they are loaded from disk. When there is danger of the system having a memory panic, this entire cache is purged.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-16T13:11:59.000+0000", "updated": "2012-01-16T13:11:59.000+0000" }, { "id": "179447", "author": { "name": "cecileadam", "key": "cecileadam", "displayName": "Cécile Adam", "active": true, "timeZone": "America/Los_Angeles" }, "body": "thank you Steven, but my experience is that the app crashes.\r\nwhen on the device (iPad) the app received a memory warning Level 2, then crashes\r\n\r\nI'm very disappointed because it worked like a charm with SDK 1.7.5", "updateAuthor": { "name": "cecileadam", "key": "cecileadam", "displayName": "Cécile Adam", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-16T13:43:20.000+0000", "updated": "2012-01-16T13:43:20.000+0000" }, { "id": "179462", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Do you have a crash log that can be attached to the ticket?", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-16T14:44:07.000+0000", "updated": "2012-01-16T14:44:07.000+0000" }, { "id": "179533", "author": { "name": "cecileadam", "key": "cecileadam", "displayName": "Cécile Adam", "active": true, "timeZone": "America/Los_Angeles" }, "body": "don't know how to attach file as I don't seem to have the right to edit this issue.\r\n\r\nSo, the console : http://pastie.org/3199910\r\nAnd the crashlog : http://pastie.org/3199922", "updateAuthor": { "name": "cecileadam", "key": "cecileadam", "displayName": "Cécile Adam", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-17T00:18:47.000+0000", "updated": "2012-01-17T00:18:47.000+0000" }, { "id": "179646", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This looks like an issue unrelated to caching - it seems to be being caused by some of our property setters. I'm working on resolving it right now.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-17T14:16:44.000+0000", "updated": "2012-01-17T14:16:44.000+0000" }, { "id": "180207", "author": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing bug. Verified fix on:\r\n\r\nSDK build: 1.9.0.v20120121223134\r\nTitanium Studio, build: 1.0.8.201201210622\r\nXcode: 4.2\r\nOS: Mac OS X Lion (10.7.2)\r\nDevice: iPad 2 (5.0.1)", "updateAuthor": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-01-23T11:53:27.000+0000", "updated": "2012-01-23T11:53:27.000+0000" }, { "id": "180429", "author": { "name": "cecileadam", "key": "cecileadam", "displayName": "Cécile Adam", "active": true, "timeZone": "America/Los_Angeles" }, "body": "works fine, thanxs", "updateAuthor": { "name": "cecileadam", "key": "cecileadam", "displayName": "Cécile Adam", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-24T10:28:24.000+0000", "updated": "2012-01-24T10:28:24.000+0000" }, { "id": "181415", "author": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "body": "updated labels", "updateAuthor": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-02-01T16:51:12.000+0000", "updated": "2012-02-01T16:51:12.000+0000" }, { "id": "184032", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Reopening to edit sample JS.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-02-22T18:36:30.000+0000", "updated": "2012-02-22T18:36:30.000+0000" } ], "maxResults": 16, "total": 16, "startAt": 0 } } }