Analyzer Problem??
Analyzer Problem??
- Subject: Analyzer Problem??
- From: Dave <email@hidden>
- Date: Mon, 15 Jun 2015 19:19:09 +0100
Hi All,
Please take a look at the method below and look for the // ******* comments
+(void) selfTest
{
LTWIndexBuffer* myIndexBuffer1;
LTWIndexBuffer* myIndexBuffer2;
LTWIndexBuffer* myIndexBuffer3;
LTWIndexBuffer* myIndexBuffer4;
LTWIndexBuffer* myIndexBuffer5;
LTWIndexBuffer* myIndexBuffer6;
NSUInteger myInitIndexBuffer1[] = {1,2,3,4,5};
NSUInteger myInsertIndexBuffer1[] = {100,200,300,400,500};
NSIndexPath* myIndexPath;
NSMutableArray* myArray;
NSArray* mySortedArray;
myIndexBuffer1 = [[[self class] alloc] initWithIndex:1];
myIndexBuffer2 = [[[self class] alloc] initWithIndexes:&myInitIndexBuffer1[0] length:sizeof(myInitIndexBuffer1) / (sizeof(NSUInteger))];
myIndexPath = [[NSIndexPath alloc] initWithIndexes:&myInitIndexBuffer1[0] length:sizeof(myInitIndexBuffer1) / (sizeof(NSUInteger))];
myIndexBuffer3 = [[[self class] alloc] initWithMaximumIndexLength:0 andIndexPath:myIndexPath];
myIndexBuffer4 = [[[self class] alloc] initWithIndexBuffer:myIndexBuffer3];
[myIndexBuffer4 insertIndexes:&myInsertIndexBuffer1[0] atPosition:11 length:sizeof(myInsertIndexBuffer1) / (sizeof(NSUInteger))];
[myIndexBuffer4 dumpIndexesWithMessage:@"myIndexBuffer4"];
[myIndexBuffer4 insertIndexes:&myInsertIndexBuffer1[0] atPosition:5 length:sizeof(myInsertIndexBuffer1) / (sizeof(NSUInteger))];
[myIndexBuffer4 dumpIndexesWithMessage:@"myIndexBuffer4"];
[myIndexBuffer4 insertIndexes:&myInsertIndexBuffer1[0] atPosition:0 length:sizeof(myInsertIndexBuffer1) / (sizeof(NSUInteger))];
[myIndexBuffer4 dumpIndexesWithMessage:@"myIndexBuffer4"];
myIndexBuffer5 = [[[self class] alloc] initWithIndexBuffer:myIndexBuffer4];
myIndexBuffer6 = [myIndexBuffer4 copy];
[myIndexBuffer6 deleteIndexesAtPosition:0 length:5];
[myIndexBuffer6 dumpIndexesWithMessage:@"myIndexBuffer6"];
[myIndexBuffer6 deleteIndexesAtPosition:4 length:5];
[myIndexBuffer6 dumpIndexesWithMessage:@"myIndexBuffer6"];
[myIndexBuffer6 deleteIndexesAtPosition:9 length:11];
[myIndexBuffer6 dumpIndexesWithMessage:@"myIndexBuffer6"];
[myIndexBuffer6 deleteIndexesAtPosition:5 length:2];
[myIndexBuffer6 dumpIndexesWithMessage:@"myIndexBuffer6"];
[myIndexBuffer6 deleteIndexesAtPosition:5 length:1];
[myIndexBuffer6 dumpIndexesWithMessage:@"myIndexBuffer6"];
[myIndexBuffer6 deleteIndexesAtPosition:5 length:1];
[myIndexBuffer6 dumpIndexesWithMessage:@"myIndexBuffer6"];
if ([myIndexBuffer6 isEqual:myIndexBuffer2] == NO)
LogIfDave(@"myIndexBuffer6 is NOT Equal to myIndexBuffer2");
else
LogIfDave(@"myIndexBuffer6 IS Equal to myIndexBuffer2");
[myIndexBuffer6 dumpIndexesWithMessage:@"myIndexBuffer6"];
[myIndexBuffer6 insertIndexes:&myInsertIndexBuffer1[0] atPosition:-1 length:sizeof(myInsertIndexBuffer1) / (sizeof(NSUInteger))];
[myIndexBuffer6 dumpIndexesWithMessage:@"myIndexBuffer6"];
[myIndexBuffer6 insertIndexesFromIndexBuffer:myIndexBuffer2 atPosition:-1];
[myIndexBuffer6 dumpIndexesWithMessage:@"myIndexBuffer6"];
[myIndexBuffer6 insertIndex:997 atPosition:0];
[myIndexBuffer6 dumpIndexesWithMessage:@"myIndexBuffer6"];
[myIndexBuffer6 insertIndex:998 atPosition:8];
[myIndexBuffer6 dumpIndexesWithMessage:@"myIndexBuffer6"];
[myIndexBuffer6 insertIndex:999 atPosition:-1];
[myIndexBuffer6 dumpIndexesWithMessage:@"myIndexBuffer6"];
if ([myIndexBuffer6 isEqual:myIndexBuffer2] == NO)
LogIfDave(@"myIndexBuffer6 is NOT Equal to myIndexBuffer2");
else
LogIfDave(@"myIndexBuffer6 IS Equal to myIndexBuffer2");
myArray = [[NSMutableArray alloc] init]; //************************* No Memory leak warning!!!!!
[myArray addObject:myIndexBuffer1];
[myArray addObject:myIndexBuffer2];
[myArray addObject:myIndexBuffer3];
[myArray addObject:myIndexBuffer4];
[myArray addObject:myIndexBuffer5];
[myArray addObject:myIndexBuffer6];
LogIfDave(@"Before Sort: %@",myArray);
mySortedArray = [myArray sortedArrayUsingSelector:@selector(compareAscending:)];
LogIfDave(@"After Sort compareAscending: %@",mySortedArray);
mySortedArray = [myArray sortedArrayUsingSelector:@selector(compareDecending:)];
LogIfDave(@"After Sort compareDecending: %@",mySortedArray);
LogIfDave(@"-------------------------");
[myIndexBuffer1 dumpIndexesWithMessage:@"myIndexBuffer1"];
[myIndexBuffer2 dumpIndexesWithMessage:@"myIndexBuffer2"];
[myIndexBuffer3 dumpIndexesWithMessage:@"myIndexBuffer3"];
[myIndexBuffer4 dumpIndexesWithMessage:@"myIndexBuffer4"];
[myIndexBuffer5 dumpIndexesWithMessage:@"myIndexBuffer5"];
[myIndexBuffer6 dumpIndexesWithMessage:@"myIndexBuffer6"];
[myIndexBuffer1 release]; //*************************If I comment out this line, I DO get a warning on myIndexBuffer1
[myIndexBuffer2 release];
[myIndexBuffer3 release];
[myIndexBuffer4 release];
[myIndexBuffer5 release];
[myIndexBuffer6 release];
[myIndexPath release];
}
Is this a bug? I’ve spotted this before, but then it happened with an object that was in a Framework and I thought it was because of that, but this is defined in my app.
All the Best
Dave
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden