Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7577235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:07:57+00:00 2026-05-30T17:07:57+00:00

I am developing an application in which I have a display a lot of

  • 0

I am developing an application in which I have a display a lot of images in my table view.These images has to come from server, so I have create another thread in which the image get processed and then set on table view cell to make our table view scrolls smoothly and properly.
My problem is when I scrolls my table view to a number of times, the app get freezes and after some time the xcode shows the message shown in below image:-
enter image description here

  My table view cell code :-

    id object = [imageDictFunctionApp objectForKey:[NSString stringWithFormat:@"%d",functionAppButton.tag]];
                    if(!object){    

                        NSArray *catdictObject=[NSArray arrayWithObjects:[NSNumber numberWithInt:functionAppButton.tag],indexPath,[NSNumber numberWithInt:i],nil];
                        NSArray *catdictKey=[NSArray arrayWithObjects:@"btn",@"indexPath",@"no",nil];
                        NSDictionary *catPassdict=[NSDictionary dictionaryWithObjects:catdictObject forKeys:catdictKey];
                        [NSThread detachNewThreadSelector:@selector(displayingSmallImageForFunctionsApps:) toTarget:self withObject:catPassdict]; 

                    }
                    else
                    {
                        if(![object isKindOfClass:[NSNull class]]){
                            UIImage *img = (UIImage *)object;
                            [functionAppButton setImage:img forState:UIControlStateNormal];
                        }


-(void)displayingSmallImageForFunctionsApps:(NSDictionary *)dict
{
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    NSIndexPath *path=[dict objectForKey:@"indexPath"];
    NSArray *catArray=[self.functionDataDictionary objectForKey:[self.functionsKeysArray objectAtIndex:path.row]];
    int vlaue=[[dict objectForKey:@"no"] intValue];
    NSDictionary *dict1=[catArray objectAtIndex:vlaue];
    NSString *urlString=[dict1 objectForKey:@"artwork_url_large"];
    NSURL *url = [NSURL URLWithString:urlString];
    UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:url]];

    if(image){
        [imageDictFunctionApp setObject:image forKey:[NSString stringWithFormat:@"%d",[[dict objectForKey:@"btn"] intValue]]];
        NSMutableDictionary *dict2=[NSMutableDictionary dictionaryWithCapacity:4];
        [dict2 setObject:image forKey:@"imageValue"];
        [dict2 setObject:[dict objectForKey:@"btn"] forKey:@"tag"];
        [dict2 setObject:[dict objectForKey:@"indexPath"] forKey:@"indexPath"];
        [self performSelectorOnMainThread:@selector(setImageInCellDictCategroryTable:) withObject:dict2  waitUntilDone:NO];


    }
    else{
        [imageDictFunctionApp setObject:[NSNull null] forKey:[NSString stringWithFormat:@"%d",[[dict objectForKey:@"btn"] intValue]]];
    }

    [pool drain];

}

- (void)setImageInCellDictCategroryTable:(NSDictionary *)dict{
    UITableViewCell *myCell = (UITableViewCell *)[categoriesAndFunctionsTableView cellForRowAtIndexPath:[dict objectForKey:@"indexPath"]];
    UIButton *myBtn = (CustomUIButton *)[myCell viewWithTag:[[dict objectForKey:@"tag"] intValue]];
    if ([dict objectForKey:@"imageValue"]) {
        [myBtn setImage:[dict objectForKey:@"imageValue"] forState:UIControlStateNormal];
    }   
}

I have posted all my code that might be linked with this error.Please anyone suggest me how to solve this issue.

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:07:58+00:00Added an answer on May 30, 2026 at 5:07 pm

    So what I would guess is happening is that you are running out of Mach ports. It looks to me like you are starting a thread for every single cell in your table and then they are all trying to schedule tasks to run on the main runloop when they are done. This is going to stress your system.

    I would create an NSOperation for each image and schedule them all on the same NSOperationQueue. The runtime will use a pool of threads tuned to the specific system to run all of the operations.

    For a simple thing like this, you can also use GCD as Oscar says, but I recently read on the Apple list that NSOperationQueue is preferred because it is higher level. It gives you more options for controlling what happens to your background tasks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an iphone application which have a complicated view is to display
I am developing a JSF application which has a servlet to display binary images.
I am developing an application in which i have to get data from .xls
I am developing an application in C# WPF which will have Client-Server architecture (Client
I am developing a web application which has Chart Controls. I have developed a
In an application we are developing, I have access to a database table which
I am developing an android application in which I have passed a string from
I am currently developing an ASP.net c# application. I have a grid view which
I am developing an android application in which i have a database table and
I'm developing an application which currently have hundreds of objects created. Is it possible

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.