views:

104

answers:

2

Hi all,

I had a problem with my iPad application that is, I need to download more than 10,000 images from a server at a time. I successfully downloaded more than 8000 images, But after that I got an exception like "Program received signal: “0”. Data Formatters temporarily unavailable, will re-try after a 'continue'. (Unknown error loading shared library "/Developer/usr/lib/libXcodeDebuggerSupport.dylib") (gdb)" this in the debugger. I tested the memory management. There are no issues in memory management. But still I got the exception. Please help me.

Thanks in advance, Sekhar Bethalam.

+1  A: 
dreamlax
A: 

Hi, This is my code which I mentioned above,

for (int i=0;i<10000;i++) { printf("\n generating images..............:%d",i); i++;

        UIImageView* imageView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, spotItem.imageWidth, spotItem.imageHight)];
        NSData *receivedData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://sererpath/prudently/iphone/image_s/e545afbf-4e3e-442e-92f9-a7891fc3ea9f/test.png"]];
        imageView.image = [[UIImage alloc] initWithData:receivedData] ;
        //imageView.image=[UIImage imageNamed:@"1.png"];
        [spotItem.subView addSubview:imageView];
        [imageView release];



    }

I was downloading them directly.

sekhar
Yes, the problem could be that you are creating two autoreleased objects every iteration of the loop (the `NSData` and `NSURL`). This means that once your loop ends, the autorelease pool will contain at least 20,000 items (and who knows how much memory these 20,000 items are using in total!). Try following my advice in my answer (creating an NSAutoreleasePool at the beginning of the loop, and releasing it at the end).
dreamlax