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 3935266
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:48:36+00:00 2026-05-19T23:48:36+00:00

My app seems to be crashing on some line (console does not give exact

  • 0

My app seems to be crashing on some line (console does not give exact idea). I just get Program received ERROR signal. Could you please let me know if there is some leak or other issue in the following code…I am releasing the properties in dealloc method;

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    self.curr_rep_date = [[NSMutableString alloc] init];
    retrievedArray = [[Shared sharedManager] books];

    NSString *urlstr_replist_curr = [[[NSString alloc] initWithFormat:@"http://xyz.com", [[retrievedArray objectAtIndex:selectedIndex] BookNumber]] autorelease];
    NSData* xmlData_replist = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlstr_replist_curr] ];
    replist_rptdt_dict = (NSMutableDictionary *)PerformXMLXPathQuery(xmlData_replist, @"//XX/YY[@RD]"); 
    replist_rpttype_dict = (NSMutableDictionary *)PerformXMLXPathQuery(xmlData_replist, @"//XX/YY[@RT='A']"); 

    NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init]  autorelease];
    [dateFormatter setDateFormat:@"YYYY"];
    NSDate *date = [NSDate date];
    int tmpCurrYearInt = [[dateFormatter stringFromDate:date] intValue];

    NSString *tmpRptDt;
    NSMutableArray *tempArrDt;

    for (NSDictionary *period in replist_rpttype_dict){
        for (NSDictionary *nodeAttributeArray in [period objectForKey:@"nodeAttributeArray"]){
            NSString *tmpAttrName = [nodeAttributeArray objectForKey:@"attributeName"];

            if ([tmpAttrName isEqualToString:@"ReportDate"]) {
                tmpRptDt = [nodeAttributeArray objectForKey:@"nodeContent"];

                tempArrDt = (NSMutableArray *)[tmpRptDt componentsSeparatedByString:@"-"];
                tmpYrVal = [[tempArrDt lastObject] intValue];

                if (tmpYrVal == tmpCurrYearInt) {
                    self.curr_rep_date = [NSString stringWithFormat:@"%d", tmpRptDt];
                }
                else if (tmpYrVal == (tmpCurrYearInt-1)) {
                    self.curr_rep_date = (NSMutableString *)[tmpRptDt stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%d",tmpYrVal] withString:[NSString stringWithFormat:@"%d",(tmpCurrYearInt-1)]];
                }
                else if (tmpYrVal == (tmpCurrYearInt-2)) {
                    self.curr_rep_date = (NSMutableString *)[tmpRptDt stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%d",tmpYrVal] withString:[NSString stringWithFormat:@"%d",(tmpCurrYearInt-2)]];
                }
                else {
                    parse_error_str = [NSMutableString stringWithString:@"Report error"];
                }

            }
        }
    }
    NSLog(@"tmpRptDt is %@, Curr Rep date is %@",tmpRptDt, self.curr_rep_date);

    [urlstr_replist_curr release];

    [tableView reloadData];
}

In dealloc, I am releasing;

[parse_error_str release];
    [replist_rptdt_dict release];
    [replist_rpttype_dict release];
    [curr_rep_date release];
    [aBook release];
    [tableView release];
  • 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-19T23:48:37+00:00Added an answer on May 19, 2026 at 11:48 pm

    If your curr_rep_date property is declared as retain or copy, then this is a leak:

    self.curr_rep_date = [[NSMutableString alloc] init];
    

    +alloc will return an instance you own, and the property is going to declare ownership as well (by sending retain to the array).

    You should be doing:

    self.curr_rep_date = [NSMutableString string];
    

    In addition, doing things like:

    tempArrDt = (NSMutableArray *)[tmpRptDt componentsSeparatedByString:@"-"];
    

    Or

    self.curr_rep_date = (NSMutableString *)[tmpRptDt stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%d",tmpYrVal] withString:[NSString stringWithFormat:@"%d",(tmpCurrYearInt-1)]];
    

    Are totally wrong. Casting does not actually change the type of an object. It just shuts up the compiler. So -componentsSeparatedByString: will always return an immutable array, even if you cast it to an NSMutableArray (or anything else). Pay attention to return types.

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

Sidebar

Related Questions

I have an app where it seems to me that memory is not being
It seems that calling a P-Invoke while the App is not completed loaded make
My app has a registered shutdown function and it seems there's some issues with
My WPF app seems to be crashing when I flip a media element around
I am having some problems with an app that keeps crashing intermittently. Code below
My app is crashing on Lion when it awakes from sleep. The problem seems
Our app is good to go and everything seems to work just fine. We
My app is crashing when testing on the device, but not on the simulator.
Our heroku staging app is crashing on start up due to not being able
My GitHub app seems to be adding new SSH keys to github every time

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.