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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:47:14+00:00 2026-05-15T13:47:14+00:00

under the Guaranteeing the Foundation Ownership Policy in Apple developer’s site article on Autorelease

  • 0

under the “Guaranteeing the Foundation Ownership Policy” in Apple developer’s site article on Autorelease pool
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmAutoreleasePools.html#//apple_ref/doc/uid/20000047-997594, they talk about extending an object’s lifetime beyond the Autorelease pool.

Can someone give me a situation where this concept could be used?

  • 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-15T13:47:15+00:00Added an answer on May 15, 2026 at 1:47 pm

    Short answer: What the documentation is saying is that if you need to keep an object that has been autoreleased in an autorelease pool, you need to retain it.

    Long answer: For instance, say I need to do a certain operation to 1000 objects. Once I’m done with these objects I’m going to autorelease them. Without an autorelease pool, they’re going to be eventually released, but holding those 1000 objects in memory can make your program really slow (at least until they’re autoreleased).

    In order to solve this issue, I’m creating an autorelease pool that will be cleaned every 100 objects. However, what happens if I need to keep the last object of the last batch around? I still need to purge those other 99 objects. What I’m going to do is send a retain message to that very last object then clean the autorelease pool.

    This way the autorelease pool will notify the system that it no longer wants those 100 items, but you’ve already let the system know that you do need one of them. If the object had a previous retain count of 1, then it’ll still be around:

    1 (original retain count) +1 (your retain) -1 (autorelease pool release) = 1.

    This preserves the object after the autorelease pool is done with it.

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

Sidebar

Related Questions

Under a corporate apple developer account, is it possible to add more than one
Under this link : http://dev1.gecoloco.com/rte/done_json.php I have a json-like object, that I'm operating on.
under IE7: ie http://run.xxmn.com/images/ie.jpg under firefox firefox http://run.xxmn.com/images/firefox.jpg I made a style on the
Under what conditions should a developer consider changing the default isolation level explicitly defined
Under the user generated posts on my site, I have an Amazon-like rating system:
Under Ubuntu 10, I installed using: npm install js2coffee Seems to install smoothly I
Under what specific situation is it ok (or even recommended) to present end-users with
Under Windows 7 I have a batch file for checking the status of some
Under the .NET Compact Framework, there is no FormWindowState.Minimize value. How can I minimize
Under MacOSX, I can create a file under root (/) without having admin rights.

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.