Ok... Hello everybody I have not been able to solve this one. I have TONS of leaks inside my code and I cannot figure out why.
First you should know, this code is running in background, so I create a autorelease pool for it. Well, to be honest, MBprogressHUD does for me.
The code works, but Instruments says I have some leaks in the creation (alloc/init) of diccionario, creation of temporal array, creation of temporalMutable array, etc. Almost every piece of code that does any alloc/autorelease gets a leak.
Any ideas?
// Some more code at the beginning
NSMutableDictionary *diccionario=[[NSMutableDictionary alloc] init];
for (Horas *hora in [dia oraciones]) {
if ([diccionario objectForKey:[hora Tipo]]==nil)
{
NSArray *temporal=[NSArray arrayWithObjects:[hora Hora],[hora Texto], nil];
NSMutableArray *temporalMutable=[NSMutableArray arrayWithObjects:temporal, nil];
[diccionario setObject:temporalMutable forKey:[hora Tipo]];
}
else
{
NSMutableArray *nuevo=[diccionario objectForKey:[hora Tipo]];
NSArray *temporal=[NSArray arrayWithObjects:[hora Hora],[hora Texto], nil];
[nuevo addObject:temporal];
[diccionario setObject:nuevo
forKey:[hora Tipo]];
}
}
MyClass *resultado=[[[MyClass alloc] initSinDescarga:fecha tituloDia:[dia titulo] celebracionDia:[dia celebracion] oracionesDia:diccionario] autorelease];
[diccionario release];
return resultado;
}