{ "id": "62945", "key": "TIMOB-2313", "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:58:44.000+0000", "created": "2011-04-15T03:16:27.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "android", "defect" ], "versions": [], "issuelinks": [], "assignee": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2011-04-17T01:58:44.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}

Our internal code that loads bitmaps using resource ids does not\nhave the protection afforded by using certain BitmapFactory.Options\nwhich we use when loading the bitmaps by url (instead of resource\nid). This was an oversight.

\n

Failcase:

\n

Put the attached PNG into Resources/android/images/medium, then\nrun this app.js:

\n
\n/*global Ti, Titanium, alert, JSON */\nTitanium.UI.setBackgroundColor('#000');\nvar win = Titanium.UI.createWindow({  \n    title:'Test',\n    backgroundColor:'#fff',\n    fullscreen: true,\n    exitOnClose: true\n});\nwin.open();\n\nvar tv = Ti.UI.createTableView();\nvar i = 0;\nwin.add(tv);\n\nvar images = [];\nfor (i = 0; i < 25; i++) {\n    images.push('images/test.png');\n}\n\nfor (i = 0 ; i < 50; i++) {\n    var tr = Ti.UI.createTableViewRow();\n    tr.add(\n        Ti.UI.createImageView({images: images})\n    );\n    tv.appendRow(tr);\n}\n
\n

The app should crash and if you look at the logcat you should\nsee similar to:

\n
\nE/AndroidRuntime(  450): java.lang.OutOfMemoryError: bitmap size exceeds VM budget\nE/AndroidRuntime(  450):    at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)\nE/AndroidRuntime(  450):    at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:447)\nE/AndroidRuntime(  450):    at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)\nE/AndroidRuntime(  450):    at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:346)\nE/AndroidRuntime(  450):    at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:372)\nE/AndroidRuntime(  450):    at org.appcelerator.titanium.util.TiUIHelper.getResourceBitmap(TiUIHelper.java:543)\nE/AndroidRuntime(  450):    at ti.modules.titanium.ui.widget.TiUIImageView.createBitmap(TiUIImageView.java:137)\nE/AndroidRuntime(  450):    at ti.modules.titanium.ui.widget.TiUIImageView$Loader.run(TiUIImageView.java:268)\nE/AndroidRuntime(  450):    at java.lang.Thread.run(Thread.java:1096)\n
{html}", "attachment": [ { "id": "18134", "filename": "test.png", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:16:27.000+0000", "size": 5043, "mimeType": "image/png" } ], "flagged": false, "summary": "Android: bitmaps fetched by resource id more susceptible to out-of-memory errors", "creator": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "128135", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

(from [dad7bc94565a627a14323e5b08ad5a562724fcbf])\n[#2313 state:fixed-in-qa] Use\nBitmapFactory.Options options to help avoid OOM errors loading\nbitmaps by resource id \nhttps://github.com/appcelerator/titanium_mobile/commit/dad7bc94565a...

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:16:28.000+0000", "updated": "2011-04-15T03:16:28.000+0000" }, { "id": "128136", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

(from [5e35a4041f17c7cb0a71190ba4a79547315fc910])\n[#2313 state:fixed-in-qa] Use\nBitmapFactory.Options options to help avoid OOM errors loading\nbitmaps by resource id \nhttps://github.com/appcelerator/titanium_mobile/commit/5e35a4041f17...

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:16:28.000+0000", "updated": "2011-04-15T03:16:28.000+0000" }, { "id": "128137", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

(from [7ff8c90985b6d922ffe46e0d2e12b22c434f06dd])\n[#2313 state:fixed-in-qa] add drillbit \nhttps://github.com/appcelerator/titanium_mobile/commit/7ff8c90985b6...

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:16:28.000+0000", "updated": "2011-04-15T03:16:28.000+0000" }, { "id": "128138", "author": { "name": "mschmulen", "key": "mschmulen", "displayName": "Matt Schmulen", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Pass Titanium SDK version: 1.5.0 (12/01/10 09:30 ac7cfd8)\ndrillbit test Android Sim 1.6/2.1

\n

android sim 1.6
\n\nhttps://5111068499667359260-a-appcelerator-com-s-sites.googlegroups...

\n

android sim 2.1
\n\nhttps://5111068499667359260-a-appcelerator-com-s-sites.googlegroups...

{html}", "updateAuthor": { "name": "mschmulen", "key": "mschmulen", "displayName": "Matt Schmulen", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:16:28.000+0000", "updated": "2011-04-15T03:16:28.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }