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

  • Home
  • SEARCH
  • 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 8720075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:56:53+00:00 2026-06-13T06:56:53+00:00

I have an application which is working fine.But i need to be memory leaks

  • 0

I have an application which is working fine.But i need to be memory leaks free.So i decided to build with analyzer,then i saw so many small small memory management issues.I sorted out almost everything except this.here my cell object is shown as a leaked object,but really i don’t know where i was wrong footed.this is my cellforRowatIndexpath method .

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:EventCellIdentifier];


    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:EventCellIdentifier];

        UIImageView* img = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"cell_with_arrow.png"]];
        [cell setBackgroundView:img];
        [img release];    

        cell.textLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:13.0];
        cell.textLabel.lineBreakMode = UILineBreakModeWordWrap; // Pre-iOS6 use UILineBreakModeWordWrap
        cell.textLabel.numberOfLines =0; 
        [cell.textLabel sizeToFit];


    }


     [[cell viewWithTag:12] removeFromSuperview];
    [[cell viewWithTag:13] removeFromSuperview];

    PTPusherEvent *event = [eventsReceived objectAtIndex:indexPath.row];







    //cell.textLabel.text = event.name;
    // cell.detailTextLabel.text = [event.data description];

    NSDictionary *payload =event.data;
    NSLog(@"%@",payload);
    NSString *tes=[payload objectForKey:@"from"];
    NSString *subtitle = [NSString stringWithString: @"From "];
    subtitle = [subtitle stringByAppendingFormat:@"%@",tes];










    cell.detailTextLabel.text = subtitle;
    cell.textLabel.text = [payload objectForKey:@"message"];

    cell.textLabel.backgroundColor = [UIColor clearColor];
    cell.detailTextLabel.backgroundColor = [UIColor clearColor]; 



    NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
    // [dateFormat setDateFormat:@"dd-MMM-YYYY HH:mm:ss"];
    [dateFormat setDateFormat:@"dd-MMM-YYYY hh:mm a"];
    [dateFormat setTimeZone:[NSTimeZone defaultTimeZone]]; 
    NSDate *todaysdate=[NSDate date];
    NSString *todaysdateString = [dateFormat stringFromDate:todaysdate];
    [dateFormat release];

    CGSize boundingSize = CGSizeMake(320, CGFLOAT_MAX);
    CGSize requiredSize = [cell.textLabel.text sizeWithFont:cell.textLabel.font
                                          constrainedToSize:boundingSize
                                              lineBreakMode:UILineBreakModeWordWrap];
    CGFloat requiredHeight = requiredSize.height;  


    MarqueeLabel *rateLabelOne =  [[MarqueeLabel alloc] initWithFrame:CGRectMake(115, requiredHeight+15,155, 20) rate:50.0f andFadeLength:10.0f];    
    rateLabelOne.numberOfLines = 1;
    rateLabelOne.marqueeType = MLContinuous;
    rateLabelOne.opaque = NO;
    rateLabelOne.enabled = YES;
    rateLabelOne.shadowOffset = CGSizeMake(0.0, -1.0);
    rateLabelOne.textAlignment = UITextAlignmentRight;
    rateLabelOne.textColor = [UIColor redColor];
    rateLabelOne.backgroundColor = [UIColor clearColor];
    rateLabelOne.font = [UIFont fontWithName:@"Helvetica-Bold" size:12.000];
    rateLabelOne.text = @"OFFline!cannot communicate now.....";

    MarqueeLabel *rateLabelTwo = [[MarqueeLabel alloc] initWithFrame:CGRectMake(215, requiredHeight+15,100, 20) rate:50.0f andFadeLength:10.0f];
    rateLabelTwo.marqueeType = MLContinuous;
    rateLabelTwo.numberOfLines = 1;
    rateLabelTwo.opaque = NO;
    rateLabelTwo.enabled = YES;
    rateLabelTwo.shadowOffset = CGSizeMake(0.0, -1.0);
    rateLabelTwo.textAlignment = UITextAlignmentRight;
    rateLabelTwo.textColor = [UIColor blueColor];
    rateLabelTwo.backgroundColor = [UIColor clearColor];
    rateLabelTwo.font = [UIFont fontWithName:@"Helvetica" size:12.000];
    rateLabelTwo.text = todaysdateString;

    if([chatstatus isEqualToString:@"online"])
    {

        rateLabelTwo.tag=12;

        [cell addSubview:rateLabelTwo];
        [rateLabelTwo release];



    }
    else
    {
        rateLabelOne.tag=13;

        [cell addSubview:rateLabelOne];
        [rateLabelOne release];



    }


return cell;
}

Can anybody help me to find out where is that monster?

  • 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-06-13T06:56:54+00:00Added an answer on June 13, 2026 at 6:56 am

    You need to put an autorelease as,

    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:EventCellIdentifier] autorelease];
    

    Otherwise it will be leaked.

    Update:

    As mentioned by AppleDelegate,

    [rateLabelTwo release]; and [rateLabelOne release]; also need to be moved out of the if condition so that it will be released in both if and else cases. Analyzer will detect this also as a leak.

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

Sidebar

Related Questions

I have one web application which I have been working for some time.I am
I have Developed an Stand alone application (.jar) which is working on Linux environment,
I have developed a simple location aware iPhone application which is functionally working very
I have been working on a facebook application which will be using Graph API
I have been working on an application which allows the user to make a
I have a calculator application in java swing, which is working properly with mouse
I have been working with iPhone application in which i am using sqlite database.
I'm working on an application for iOS which will have the user fill out
I'm working on an application so i have write an dll which contain a
I'm working on a project which will end up have a lot of application

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.