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

  • Home
  • SEARCH
  • 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 im real new to c++ and can't seem to understand the basic concept
Sorry I'm new here and my code will probably not be properly displayed... how
Sorry i'm new to spring and have a question about the httpinvokerserviceexporter. I had
Sorry i'm new in C# and i'm looking everywhere, and can't find even it
Im pretty new to Core Data programming and Cocoa in general, so no wonder
Sorry I am very new to open graph and have been having difficulty to
Sorry for the poor title,I'm new to OOP so I don't know what is
Sorry, but I'm new to accessing return from another domain. I have this url
I'm new to this topic so sorry if this is a stupid question :\
new to this site so sorry if this question is inappropriate, or in the

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.