开发者

leaks inside thread

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];
        [dicci开发者_开发知识库onario 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;

}


Ok Ok Thanks no everyone who has tried to have a look at it.

The problem is that I was NOT releasing an instance variable, and Instruments points a leak where the memory is allocated NOT where it is leaked... So... I was confused.

Thanks again

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜