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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:18:37+00:00 2026-05-28T00:18:37+00:00

I am sorry, I am new with cocoa programming and I am not sure

  • 0

I am sorry, I am new with cocoa programming and I am not sure if I really understand how nsautoreleasepool works.

Everywhere I read says something about the NSAutoreleasePool are responsable for all autorelease calls (talking about the last NSAutoreleasePool declared).

Considering the follow code:

int main(int argc, char *argv[]) {

    //NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    int retVal = UIApplicationMain(argc, argv, nil, nil);
    //[pool release];
    return retVal;
}

at some point of my application I would also have something close to this:

NSString* b = [[NSString alloc] initWithFormat:@"%d", 10];
[b autorelease];

Considering that I don’t have NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; anywhere… shouldnt the [b autorelease]; crashs the application? But the application seems to work fine apparently.

Observation: I have no intention of writing an application without NSAutoreleasePool, I just want to get well the idea of how that works. This fact made doubt about what I thought I knew.

  • 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-28T00:18:38+00:00Added an answer on May 28, 2026 at 12:18 am

    You’ll simply get a warning in the console that there’s no autorelease pool and that the object was leaked.

    If you really want to understand autorelease pools, read Mike Ash’s Let’s build NSAutoreleasePool.

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

Sidebar

Related Questions

Sorry i am so new to jQuery and not sure how to do that.
I'm really new to VSTO so sorry if this is a newbie question. I'm
Rather new to php, so sorry if this seems stupid. I'm really copying a
Sorry if the question isn't correct, I'm very new in Objective-C. I understand why
Sorry for the poor title,I'm new to OOP so I don't know what is
Sorry, I'm new to SVN and I looked around a little for this. How
Sorry, I'm new to flash I have this line of code: BaseEntry( _entryList[i] ).topTeamName
I'm sorry for opening a new question, I had to - as I wrote
I'm new in xml, sorry for the dumb question. I'm trying to create xsl
I'm new to jquery, and sorry if this question is asked before (could find

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.