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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:27:18+00:00 2026-05-17T06:27:18+00:00

Sometimes I wonder where I would be able to get great information other than

  • 0

Sometimes I wonder where I would be able to get great information other than from the stack overflow community. I suppose the Objective-C memory management handbook wouldn’t be bad, but I feel like you guys can tell me why as opposed to just what to do.

I have the following code:

NSString* rawTickerData = [[NSString alloc] initWithData: op.requestData encoding:NSUTF8StringEncoding];
NSArray* lines   = [rawTickerData componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]];

for(NSString* line in lines)
{
    NSArray* fields = [line componentsSeparatedByString:@","];

    if([fields count] > 1)
    {
        [self.tickerData addObject:fields];
    }
}
    [rawTickerData release]

Instruments tells me that fields is leaking, but trying to release it after the if statement or doing an autorelease gives an EXC_BAD_ACCESS.

The same thing happens for lines. Releasing it anywhere or trying to do autorelease gives EXC_BAD_ACCESS or “trying to double free” (for autorelease).

Yet, instruments is still saying that these are leaking. Am I missing something?

  • 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-17T06:27:19+00:00Added an answer on May 17, 2026 at 6:27 am

    Unless I’m missing something, the code you’ve posted is correct. fields is an autoreleased object that gets retained when added to self.tickerData. lines is also autoreleased, so it isn’t leaking (at least not in the code shown).

    If you’re leaking anywhere, it’s because you’re not properly cleaning up self.tickerData. If you comment out the [self.tickerData addObject:fields]; line, are you still getting leaks reported? If not, make sure you’re calling [tickerData release] (or something similar, like self.tickerData = nil) somewhere, probably in your dealloc implementation.

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

Sidebar

Related Questions

Sometimes i wonder, when converting strings to other types, for example int32, is one
I've been using debug() more often now, but sometimes I wonder which functions have
Sometimes I really wonder if my code is lastable. I do everything to make
Sometimes when I see my logging code I wonder if I am doing it
I sometimes have variables that might not be set and I would like to
I am developing a website and sometimes the browsers keeps loading, and I would
I like the immutability concept but sometimes I wonder, when an application isn't meant
I would like to use a document oriented db to store data from a
Sometimes when I program for the iPhone, I wonder when you have to allocate
My friend has a forum, which is full of posts containing information. Sometimes she

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.