I have a memory problem with this loop. I use ARC, so normally I cannot release any objects. But during this loop process, the memory grow up and the iPad crash after a moment (without warning and error).
Is there a solution to solve this problem? I don't understand why the memory grow up?
Thank you for your help.
_rawdatalocal = [NSEntityDescription insertNewObjectForEntityForName:@"RAWDATA"
inManagedObjectContext:managedObjectContext];
for(int j = 1; j <[array count];j++)
{
NSArray *values = [[NSArray alloc] initWithArray:[[array objectAtIndex:j] componentsSeparatedByString:@";"]];
if([values count] == 12)
{
_rawdatalocal.accX = [[NSNumber alloc] initWithInt:[[values objectAtIndex:1] intValue]];
_rawdatalocal.accY = [[NSNumber alloc] initWithInt:[[values objectAtIndex:2] intValue]];
_rawdatalocal.accZ = [[NSNumber alloc] initWithInt:[[values objectAtIndex:3] intValue]];
_rawdatalocal.gyrX = [[NSNumber alloc] initWithInt:[[values objectAtIndex:4] intValue]];
_rawdatalocal.gyrY = [[NSNumber alloc] initWithInt:[[values objectAtIndex:5] intValue]];
_rawdatalocal.gyrZ = [[NSNumber alloc] initWithInt:[[values objectAtIndex:6] intValue]];
_rawdatalocal.magX = [[NSNumber alloc] initWithInt:[[values objectAtIndex:7] intValue]];
_rawdatalocal.magY = [[NSNumber alloc] initWithInt:[[values objectAtIndex:8] intValue]];
_rawdatalocal.magZ = [[NSNumber alloc] initWithInt:[[values objectAtIndex:9] intValue]];
_rawdatalocal.temperature = [[NSNumber alloc] initWithFloat:[[values objectAtIndex:10] floatValue]];
_rawdatalocal.temps = [[NSNumber alloc] initWithInt:[[values objectAtIndex:11] intValue]];
}
PS : Normally the line below is in the loop
_rawdatalocal = [NSEntityDescription insertNewObjectForEntityForName:@"RAWDATA"
inManagedObjectContext:managedObjectContext];