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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:13:54+00:00 2026-05-28T01:13:54+00:00

I have provided more information on the code. The checkstatusthread() is called after every

  • 0

I have provided more information on the code. The checkstatusthread() is called after every 5 seconds. ipItemsArray object used below stores the XML coming from the server.

// XMLAppDelegate.h

@interface XMLAppDelegate : NSObject <UIApplicationDelegate> {
    NSMutableString *hostStr2;
    NSData *dataURL2;
    NSString *playlistdata;

}

@property (nonatomic, retain) NSMutableString *hostStr2;
@property (nonatomic, retain) NSData *dataURL2;
@property (nonatomic, retain) NSString *playlistdata;
@end

// XMLAppDelegate.m

-(void)checkstatusthread
{
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 

    hostStr2 = [[NSMutableString alloc] initWithFormat:@"http://%@/getplaylist.php?ip=%@",yourip,restip];

    dataURL2 = [NSData dataWithContentsOfURL: [ NSURL URLWithString: hostStr2 ]];  

    playlistdata = [[NSString alloc] initWithData:dataURL2 encoding: NSASCIIStringEncoding];

    ipItemsArray = [playlistdata componentsSeparatedByString:@"|^|"];

    [hostStr2 release]; 
    [playlistdata release];

    status =[ipItemsArray objectAtIndex:0];
    [status retain];

     if([[ipItemsArray objectAtIndex:0]isEqualToString:@"0001"])
     { 
        serverOutput1 =[ipItemsArray objectAtIndex:1];
        [serverOutput1 retain];

        nowplaying =[ipItemsArray objectAtIndex:2];    
        [nowplaying retain];

        tracklocation=[ipItemsArray objectAtIndex:3];
        [requestlocation retain];

        requestlocation=[ipItemsArray objectAtIndex:4];
        temp_app =[tracklocation intValue];


     }

        [serverOutput1 retain];
        [nowplaying retain];
        [serverOutput1 retain];
        [nowplaying retain];
        [tracklocation retain]; 
        [requestlocation retain];

        // checkstatus() called
        [self performSelectorOnMainThread:@selector(checkstatus) 
                           withObject:nil 
                        waitUntilDone:false];

    [pool drain];
}


- (void)dealloc {
    [dataURL2 release];
    [playlistdata release];
    [ipItemsArray release];
}

The line NSArray *ipItemsArray = [playlistdata componentsSeparatedByString:@"|^|"]; gives me a memory leak when I run the leaks instrument in Xcode 4.2. have tried all possible things on this, but feel like something needs to be added. Can someone please help me out.

Here is the Screenshot of the leaked object. Also i noticed my app doesn’t call Dealloc method.

enter image description 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-28T01:13:54+00:00Added an answer on May 28, 2026 at 1:13 am

    The object that is leaking is “status”. I infer that it is an iVar. When you do this:

     status =[ipItemsArray objectAtIndex:0];
    [status retain];
    

    The second time these lines get executed, the previously stored value in status is not released properly, hence a leak. You should ideally be doing this:

    if(status) {
        [status release];
    }
    status =[ipItemsArray objectAtIndex:0];
    [status retain];
    

    This will solve your leak shown in instruments. (Assuming ARC is not being used)

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

Sidebar

Related Questions

I have an Excel spreadsheet provided as a report, when really its more of
I have a std::multiset which stores elements of class A . I have provided
I have implemented an audit trail framework based on the information provided by the
So I have this SDK provided by a third party which is used for
I have a page in which i have provided a link clicking on which
I have a collection that is binded to my Listview. I have provided options
I am trying to create a directory in Java. I think I have provided
Answers provided have all been great, I mentioned in the comments of Alnitak's answer
I have been provided with a C++ DLL and associated header file in order
I have a DLL which provided a decoding function, as follows: function MyDecode (Source:

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.