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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:25:26+00:00 2026-05-28T05:25:26+00:00

I dont know why this NSXMLParser parse method is leaking. I looked at the

  • 0

I dont know why this NSXMLParser parse method is leaking.
I looked at the other similar SO question, but couldn’t resolved it.

Here is my code.

 - (void)parseXMLFileAtURL {
self.results = [[NSMutableArray alloc] init];

NSURL *xmlURL = [NSURL URLWithString:@"http://www.dukascopy.com/swiss/video/rss/"];
    NSData *dataXml = [[NSData alloc] initWithContentsOfURL:xmlURL];
NSXMLParser *MyrssParser = [[NSXMLParser alloc] initWithData:dataXml];
[dataXml release];

[MyrssParser setDelegate:self];


[MyrssParser setShouldProcessNamespaces:NO];
[MyrssParser setShouldReportNamespacePrefixes:NO];
[MyrssParser setShouldResolveExternalEntities:NO];

[MyrssParser parse]; // memory leak here
MyrssParser.delegate=nil;
[MyrssParser release];
if(!imagesArray)
{
    imagesArray = [[NSMutableArray alloc] initWithCapacity:[self.results count]];
    for(int i=0;i<[results count];i++)
    {
        UIImage *image = [UIImage imageNamed:@"nophoto.png"];
        [imagesArray addObject:image];
        bImgExist[i] = NO;
    }
}

  }

Even After releasing my NSXMLParser object instrument still shows memory leak.
What I am missing here..

  • 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-28T05:25:26+00:00Added an answer on May 28, 2026 at 5:25 am
    self.results = [[NSMutableArray alloc] init];
    

    Properties take ownership (according to their declarations) of their assigned values. So the array you set this property to is retained by self (I’m assuming the property is either retain or copy here), but already has a retain count of +1 from its initialization.

    Change the line to:

    self.results = [NSMutableArray array];
    

    And the memory leak should clear up.

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

Sidebar

Related Questions

I dont know if this is a duplicate but here's my question.. I was
sorry for this question, but i dont know where to search for it, or
I dont know if this questions is relevant here or superuser, but ask anyway.
i know this question was asked before but i have this very weird beginner
hey. friends i dont know this question is really asked before or not ?
I know this question was answered before, but I cant still handle it with
Hi I dont know if this is the right place to ask... but could
alt text http://img14.imageshack.us/img14/5020/whatbox.png I dont know what this is called, but you have 2
I dont know why this stopping criteria keeps failing but I believe it has
i dont know but this not working for me im getting garbege value when

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.