I am a beginner at this :)
I have an app which changes an image of a UIImageView when a button is pushed, each image is about 200 kb, when run in the simulator it runs ok, I can change the image many times with no problems.
When run on my device (ipod touch) it loads ok, it sluggishly gets through about 4 images and then it crashes. When I run it with the Allocations performance tool, it crashes when overall bytes reaches about 2.75 megs. Number of living allocations is about 8000 (is this high?).
My console reads this
Program received signal: “0”.
Data Formatters temporarily unavailable, will re-try after a 'continue'. (Unknown error loading shared library "/Developer/usr/lib/libXcodeDebuggerSupport.dylib")
I've also tried using the "leaks" performance tool and it doesn't find any leaks.
My .h file loads the image and uimageview like this:
@property(retain, nonatomic) IBOutlet UIImageView* myUIImageView;
@property(nonatomic, retain) UIImage *image;
Also, I release these like this:
- (void)dealloc {
[super dealloc];
[myUIImageView release];
[image release];
}
I also added in this, but it didn't seem to make any difference:
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
[myUIImageView release];
[image release];
// Release any cached data, images, etc that aren't in use.
}
I'm not sure what else to try at this point, any debugging techniques suggestions would be appreciated, also any pointers on how tackle memory issues like this would be hugely helpful, thanks!
Also, sorry forgot to add the image changing code:
- (IBAction)myButton {
static NSUInteger counter = 0;
counter++;
if (counter == 1) {
myUIImageView.image = [UIImage imageNamed:@"image1.jpg"];
}
else {
myUIImageView.image = [UIImage imageNamed:@"image2.jpg"];
counter = 0;
}
}