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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:33:27+00:00 2026-05-27T12:33:27+00:00

In my application in xml parsing method found character delegate method i use the

  • 0

In my application in xml parsing method found character delegate method i use the fallowing code

NSString *Str =  [[[NSString alloc] initWithString:foundString] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] ;

if ([weekNames containsObject:elementName]) {
  //  if (!settings) {
    //    NSMutableDictionary *dict1=[[NSMutableDictionary alloc]initWithObjectsAndKeys:@"",@"no",@"بسم الله الرحمن الرحيم",@"surah",nil];

      //  [weekDict insertObject:dict1 atIndex:0];             
    //}
    [array1 addObject:weekDict];
}
if ([elementName isEqualToString:@"DUA"]) {
    [weekDict addObject:duaDict];
}
if ([elementName isEqualToString:@"NO"]) {
    [duaDict setObject:Str forKey:@"no"];   
}
if ([elementName isEqualToString:@"SURAH"]) {
    [duaDict setObject:Str forKey:@"surah"];    
}
foundString=nil;**

If i use this code in analyze application i got potent6ial memory leak.
If i autorelease the Str it will give too many times releasing .
Why it happens like that. Please any one help me.
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-27T12:33:27+00:00Added an answer on May 27, 2026 at 12:33 pm

    This:

    NSString *Str =  [[[NSString alloc] initWithString:foundString] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]
    

    really should be:

    NSString *Str =  [foundString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
    

    What you are doing now is creating (alloc/init) a new NSString and then immediately leaking it, because you never actually save the pointer. And it turns out you never really needed that NSString to begin with.

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

Sidebar

Related Questions

I am developing an application in which I am doing XML parsing. I found
I have an application web.xml with the following entry: <error-page> <error-code>404</error-code> <location>/system_files/error/p_notfound.jsp</location> </error-page> However,
I have sample code written for parsing xml file using javax.xml package. it uses
I have got an application, that is getting data via XML-files. During the parsing-part
I am parsing images from XML and show it in My Android Application. my
I'm making an application in which I have to do XML parsing. I have
I'm developing an application on the Android system which involves parsing some xml stuff.
I'm writing a Java GUI application that is doing some XML parsing and analysis.
My android xml parsing application has stopped unexpectedly..this is the list of error in
I have a style applied to my whole application: AndroidManifest.xml: <application android:theme=@style/ApplicationStyle android:icon=@drawable/icon android:label=@string/app_name>

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.