UIImage *setColor=[[UIImage alloc] init];
is a memory leak as you are not release it. Actually the allocation is not necessary as you are assigning some other values to it. Similarly tap
is also not released as you have commented that code.
A suggestion for this. Try to put this block of code in NSAutoreleasePool
.
Edit:
-(void)onTick:(NSTimer *)timer {
//Database
UIImage *setColor;// =[[UIImage alloc] init];
for (int i=0; i<[dataArray count]; i++)
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
currentLevelMaleValue =[[[dataArray objectAtIndex:i] objectForKey:@"CurrentLevelMaleColor"] doubleValue];
printf("Current val is %f",currentLevelMaleValue);
for (OBShapedButton *obshapedCountryButtons in scrollBaseView.subviews)
{
NSAutoreleasePool * pool1 = [[NSAutoreleasePool alloc] init];
if (obshapedCountryButtons.tag==i+1)
{
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapButton:)];
tap.numberOfTouchesRequired=1;
tap.numberOfTapsRequired=1;
[obshapedCountryButtons addGestureRecognizer:tap];
[obshapedCountryButtons addTarget:self action:@selector(buttonTagTrap:) forControlEvents:UIControlEventTouchDown];
//[obshapedCountryButtons addTarget:self action:@selector(tapButton:) forControlEvents:UIControlStateHighlighted];
setColor=[obshapedCountryButtons imageForState:UIControlStateNormal];
countryCode =[self getCountryColorCurrentLevel:currentLevelMaleValue];
setColor =[setColor imageTintedWithColor:countryCode];
[obshapedCountryButtons setImage:setColor forState:UIControlStateNormal];[pool release];
// [setColor release];
// [obshapedCountryButtons release];
[tap release];
}
[pool1 drain];
}
[pool drain];
}
}