Affects Version/s: None
Component/s: Titanium SDK & CLI
Titanium version: 1.7.3, 1.7.5, 1.8.0.v20111106143455
Google APIs Android 2.2, Google APIs Android 2.3.3
a Samsung Galaxy S (android 2.3.6), a Google Nexus S (android 2.3.6) and an HTC Desire HD (android 2.3.3)
Mac OS x 10.7.2
We have a memory leak that is easily reproductible on android with table views and images.
We have reproduced this issue with:
- Titanium version: 1.7.3, 1.7.5, 1.8.0.v20111106143455
- Google APIs Android 2.2, Google APIs Android 2.3.3
- a Samsung Galaxy S (android 2.3.6), a Google Nexus S (android 2.3.6) and an HTC Desire HD (android 2.3.3)
When we add an image to a row (with 'leftImage' or with an 'imageView'), and we scroll up and down continuously during 20 seconds, our app slows down and eventually crashes.
As you can see in the logs, the free memory decrease until we have a warning
Clamp target GC heap from 33.070MB to 32.000MB
and later, the error
11-07 17:14:27.167: ERROR/GraphicsJNI(18626): VM won't let us allocate 103600 bytes
that will generate the final issues:
- some images of the table view disappear randomly
- the table view scrolls slower and slower
- if you continue the process, the app will crash with a OutOfMemoryError (11-07 17:14:45.781: ERROR/TiAnalyticsSvc(18626): java.lang.OutOfMemoryError).
The image used in the rows for the example code is taken from the web at this url (http://www.sosandroid.fr/andropress/wp-content/uploads/2009/06/appcelerator-titanium1.png), its size is "175 × 148, 14KB". When we check the headers of the request used to retrieve the url, we can see that it has cache directives (Cache-Control:max-age=604800), so we can suppose that it is cached by android.
- this issue only happens on android
- this issue only happens if we scroll the table view: A little scrollable table view will crash later, but will crash. A table view which doesn't scroll won't crash
- if you use bigger images, the app will crash much sooner (this is how we identified the issue)
- app.js: code example
- logs.rtf: logs of the crash