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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:13:34+00:00 2026-05-23T10:13:34+00:00

I have an NSString that I’ve retained, and the only place I release it

  • 0

I have an NSString that I’ve retained, and the only place I release it is in the dealloc method. For some reason, however, later in the program when I try to reference it (its length, specifically), I get a crash, saying [CFString length]:message sent to deallocated instance 0xff32c50.

I explicitly retain the string earlier in the program. Is there any reason why this would be happening? Any help is appreciated.

The string, entityParameter, is declared in the header, and defined later.
Here is some of the code:
entityParameter = [[EntitySearchWindow stringByEvaluatingJavaScriptFromString:@"f();"] retain];

The place where I’m getting the crash looks like this:
if([entityParameter length] != 0 && entityParameter != nil)
{
return;
}

  • 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-23T10:13:34+00:00Added an answer on May 23, 2026 at 10:13 am

    I have an NSString that I’ve retained,
    and the only place I release it is in
    the dealloc method. For some reason,
    however, later in the program when I
    try to reference it (its length,
    specifically), I get a crash, saying
    [CFString length]:message sent to
    deallocated instance 0xff32c50.

    Obviously, it isn’t retained, then.

    If by “retained” you mean “assigned to a property”, are you doing:

    self.prop = [NSString ...];
    

    Or:

    prop = [NSString ...];
    

    Because the former will retain (if the property is declared as retain) whereas the latter will not. Note that NSString properties should generally be declared copy, but that is orthogonal to the question).

    If your code is as written:

    entityParameter = [[EntitySearchWindow stringByEvaluatingJavaScriptFromString:@"f();"] retain];
    

    And you really do only release it in dealloc, then make sure your containing object hasn’t already been deallocated. That may be happening. Or it might be that you’ve leaked the string reference somewhere and spuriously deleted it without a retain.

    Using Zombie detection in instruments with “track retain/release events” (or whatever it is called) should show you every last retain/release event on the object, including the one the blew up.

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

Sidebar

Related Questions

I have a class that has a method: -(NSInteger) getCityCountForState:(NSString *)state CityArray:(NSMutableArray *)cityArray {
I have a NSString [WORD] that has some length [LEN]. What i need to
I have some NSString varibales that incude items like Ð and Õ and if
I have an NSString that contains some values separated by an unknown number of
I have a piece of NSString that will read Test & Test or with
I have a simple function that returns an NSString after decoding it. I use
I have an NSString that I would like to search numerically. It seems that
I have an NSString that then sets a UILabel. This contains unicode such as...
If I have an NSString that is initially: ABCDE*FGHI How do I make it
I am using libxml2 in my iPhone app. I have an NSString that holds

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.