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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:48:43+00:00 2026-05-21T15:48:43+00:00

UPDATE2 I think I found the true source of the leaks. I had some

  • 0

UPDATE2 I think I found the true source of the leaks. I had some business objects that have string properties I forgot to release. These string properties were copied from my custom xlm node object, created here (KGYXMLNode) I don’t understandt why the leak is reported here instead of my custom class. My NSString properties were copy and not retain.

UPDATE: I think it was a bug in Instruments or something or it doesn’t magically leak anymore, but since xcode 4 it doesn’t show this leak.

Hello, according to instruments i have a leak in the following code. I’ve built an objective-c wrapper around certain libxml functions to be able to parse xml docs using xpath, and in this method I’m setting the innerText for my custom node object.


-(void) SetInnerTextForNode: (xmlNodePtr) node : (KGYXMLNode *) obcNode
{
  if ((node) && (node->children))
  {
    for (xmlNodePtr pnode = node->children; pnode != NULL; pnode = pnode->next)
    {
      if (pnode->type == XML_TEXT_NODE)
      {
        xmlChar *content = pnode->content;
        NSString *innerText = [[NSString alloc] initWithUTF8String: (char *)content];
        NSString *trimmedText = [innerText stringByTrimmingCharactersInSet: trimCharSet];
        if (trimmedText.length > 0)
          obcNode.innerText = trimmedText;
        [innerText release];
        break;
      }
    }
  }
}

The leak is NSString *innerText = [[NSString alloc] initWithUTF8String: (char *)content];. I don’t know what is wrong.

  • 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-21T15:48:44+00:00Added an answer on May 21, 2026 at 3:48 pm

    You shouldn’t access a node’s content directly, instead use xmlNodeGetContent:

            xmlChar *content = xmlNodeGetContent(pnode);
            NSString *innerText = [[NSString alloc] initWithUTF8String: (char *)content];
            NSString *trimmedText = [innerText stringByTrimmingCharactersInSet: trimCharSet];
            if (trimmedText.length > 0)
              obcNode.innerText = trimmedText;
            [innerText release];
            // you must free what xmlNodeGetContent returns!
            xmlFree(content);
            break;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Several resources I have found claim, that GMail File Upload incorporates Flash to display
I have search through google and found that a lot of people is struggling
I have looked on here and found some people having some of the same
I have found out by creating 2 new websites under IIS 7 that single
UPDATE2: I think I got it now: <?php /* * @name Lawler's algorithm PHP
[2015 update: I think it's safe to say that Flash is rapidly dying. Don't
Backbone.js sents an POST on updated objects instead of an PUT. I think this
I have a pretty large tree data structure that will get updated (nodes removed
I have found this example on StackOverflow: var people = new List<Person> { new
Update 3/4: I've done some testing and proved that using checkout event handler to

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.