iOS内存注意事项

    UIImage *image1 = [UIImage imageNamed:@"xxxxxx.png"];//图片放入缓存,无法自动释放内存

    NSString *fileName = @"xxxxx.png";

 

    NSString *filePath = [[NSBundle mainBundle] pathForResource:fileName ofType:nil];

    UIImage *image2 = [[UIImage alloc] initWithContentsOfFile:filePath];

    //不走缓存, 加载后会自动释放内存,适合一次性使用的或图片占用内存比较大的情况

       

       测试app的内存使用情况

        利用xcode profile和analyze进行性能优化

        http://blog.csdn.net/xdrt81y/article/details/11036317

iOS系类教程之用instruments来检验你的app

    http://www.cocoachina.com/industry/20140114/7696.html

     

猜你喜欢

转载自zhengjj-2009.iteye.com/blog/2163828