[TIMOB-1090] Memory Usage on ImageViews
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:55:10.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.4.0 |
Components | iOS |
Labels | ios, iphone, memory, usage, views |
Reporter | ctredway |
Assignee | Reggie Seagraves |
Created | 2011-04-15T02:43:48.000+0000 |
Updated | 2011-04-17T01:55:10.000+0000 |
Description
A customer has created a slide show type of application and on a device is reporting that after view 4-5 images, the app will become unresponsive and crash.
View this ticket for reference:
http://helpdesk.appcelerator.net/tickets/2782">http://helpdesk.appcelerator.net/tickets/2782
from the customer:
It also looks like TiUIImageView is never being deleted - they just persist in memory - I put a log into TiUIImageView::dealloc, and this is never called, despite removing the item from the window that it was added to and unsetting all references to it.
Looks like there is a problem.
-(void)dealloc { NSLog ( @"TiUIImageView::dealloc %@", [NSDate date] );
if (timer!=nil)
{ [timer invalidate]; } (timer); (images); (container); (previous); (urlRequest); [super dealloc]; }
(from [1177e7b3e90095d2ea40e818e26d178f14149e78]) [#1090 state:resolved] fixed major memory leak issue on iphone http://github.com/appcelerator/titanium_mobile/commit/1177e7b3e90095d2ea40e818e26d178f14149e78"> http://github.com/appcelerator/titanium_mobile/commit/1177e7b3e9009...
I'm still experiencing memory leaks with 1.3.3. After 4-5 ImageViews loading JPEG of about 800K the app crashes (no memory). I tried setting the ImageView.image to null, ImageView to null.
While reminding myself :-) that Apple states "You should avoid creating UIImage objects there are greater than 1024x1024 in size." (http://bit.ly/ahftC2)">http://bit.ly/ahftC2), I've run some tests and I was able to reproduce the crash.
It happens when loading many ImageView instances (each with its own image) into the application. The memory quickly goes down until the app crashes. Best practice shall be then to use fewer ImageView (and smaller images), I believe.
Thanks Jeff for the good work you're doing here.
This is the test the makes the app crash (you need one/some images in your Resources folder)