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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:14:26+00:00 2026-05-17T00:14:26+00:00

Been running instruments on my app. Its says i am leaking 864bytes & 624bytes

  • 0

Been running instruments on my app. Its says i am leaking 864bytes & 624bytes from 2 NSCFString and the library responsible is Foundation.

So that leads me to believe thats its not a leak caused by me? Or is it?

Here is the offending method according to instruments. It seems to be a

substringWithRange

that is leaking.

-(void) loadDeckData
{
deckArray =[[NSMutableArray alloc] init];

NSString* path = [[NSBundle mainBundle] pathForResource:@"rugby" ofType:@"txt" 
    inDirectory:@""];
NSString* data = [NSString stringWithContentsOfFile:path encoding: 
    NSUTF8StringEncoding error: NULL];  

NSString *newString = @"";
NSString *newline = @"\n";
NSString *comma = @",";


int commaCount = 0;
int rangeCount = 0;
NSString *nameHolder = @"";
NSString *infoHolder = @"";
NSMutableArray *statsHolder = [[NSMutableArray alloc] init];

for (int i=0; i<data.length; i++) 
{

    newString = [data substringWithRange:NSMakeRange(i, 1)];

    if ([newString isEqualToString: comma]) //if we find a comma
    {
        if (commaCount == 0)// if it was the first comma we are parsing the 
                    NAME
        {
            nameHolder = [data substringWithRange:NSMakeRange(i-
                            rangeCount, rangeCount)];
        }
        else if (commaCount == 1)// 
        {
            infoHolder = [data substringWithRange:NSMakeRange(i-
                            rangeCount, rangeCount)];
            //NSLog(infoHolder);
        }
        else // if we are on to 2nd,3rd,nth comma we are parsing stats
        {
            NSInteger theValue = [[data 
                            substringWithRange:NSMakeRange(i-rangeCount,rangeCount)] 
                            integerValue];
            NSNumber* boxedValue = [NSNumber 
                            numberWithInteger:theValue];
            [statsHolder addObject:boxedValue];
        }

        rangeCount=0;
        commaCount++;
    }
    else if ([newString isEqualToString: newline]) 
    {
        NSInteger theValue = [[data substringWithRange:NSMakeRange(i-
                    rangeCount,rangeCount)] integerValue];
        NSNumber* boxedValue = [NSNumber numberWithInteger:theValue];
        [statsHolder addObject:boxedValue];
        commaCount=0;
        rangeCount=0;
        Card  *myCard = [[Card alloc] init];
        myCard.name = nameHolder;
        myCard.information = infoHolder;
        for (int x = 0; x < [statsHolder count]; x++)
             {
                 [myCard.statsArray addObject:[statsHolder                           
                                      objectAtIndex:x]];    
             }

        [deckArray addObject:myCard];       
        [myCard autorelease];
        [statsHolder removeAllObjects];


    }
    else 
    {
        rangeCount++;
    }
}
[statsHolder autorelease];
}

Thanks for your advice.
-Code

  • 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-17T00:14:26+00:00Added an answer on May 17, 2026 at 12:14 am

    As Gary’s comment suggests this is very difficult to diagnose based on your question.

    It’s almost certainly a leak caused by you however, I’m afraid.

    If you go to the View menu you can open the Extended Detail. This should allow you to view a stack trace of exactly where the leak occurred. This should help diagnose the problem.

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

Sidebar

Related Questions

I've developed an iPhone app that has been running MPMoviePlayer (pre 3.2 SDK) with
Lately I've been running into some subtle layout issues in my iOS app. For
Been running into this problem lately... When debugging an app in VS.Net 2005, breakpoints
I've been running the built-in Ant from the command line on a Macintosh (10.5.5)
So I have been running the numbers for Azure and RackSpace Cloud Servers and
So I have been running into all kinds of interesting problems in VisualStudio 2008
I have been running drush scripts (for Drupal ) with Cygwin on my relatively
I've been running through the ASP.Net MVC C# Movie Database tutorial, but been trying
I've been running through many of the text to speech examples available for Android
I have been trying to learn Erlang and have been running into some problems

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.