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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:32:59+00:00 2026-05-26T05:32:59+00:00

I was reading the ARC docs on the llvm site: http://clang.llvm.org/docs/AutomaticReferenceCounting.html#autoreleasepool ..in particular about

  • 0

I was reading the ARC docs on the llvm site: http://clang.llvm.org/docs/AutomaticReferenceCounting.html#autoreleasepool

..in particular about @autoreleasepool.

In lot of current implementation using NSAutoreleasePool, I see cases where the pool is drained periodically during a loop iteration – how do we do the same with @autorelease pool, or is it all done for us somehow under the hood?

Secondly, the docs state that if an exception is thrown, the pool isn’t drained…. ok exceptions are by name exceptional, but if they do happen, you might like to recover without leaking a load of memory. The docs don’t specify when these objects will be released.

Anyone got any info about these points?

  • 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-26T05:33:00+00:00Added an answer on May 26, 2026 at 5:33 am

    In lot of current implementation using NSAutoreleasePool, I see cases where the pool is drained periodically during a loop iteration – how do we do the same with @autorelease pool, or is it all done for us somehow under the hood?

    In the same way, i.e., by cascading autorelease pools. For instance:

    @autoreleasepool {
        …
        for (int i = 0; i < MAX; i++) {
            @autoreleasepool {
                …
            }
        }
        …
    }
    

    Secondly, the docs state that if an exception is thrown, the pool isn’t drained…. ok exceptions are by name exceptional, but if they do happen, you might like to recover without leaking a load of memory. The docs don’t specify when these objects will be released.

    In most cases the program won’t be able to recover gracefully due to the peculiar nature of exceptions in Cocoa, so I’d say that leaking objects is a lesser problem. If an @autoreleasepool block is exited because of an exception, the corresponding autoreleased objects will only get released when one of the enclosing autorelease pools is popped. But you can, of course, place @try/@catch/@finally blocks inside the @autoreleasepool block to prevent this from happening.

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

Sidebar

Related Questions

Reading this: http://guides.rubyonrails.org/routing.html#adding-more-restful-actions What does it mean to add a 'member route'? or do
I was reading a little about ARC and I saw this: @interface Address :
Reading the documentation at http://jersey.java.net/nonav/documentation/latest/client-api.html#d4e704 makes me think that ClientFilter s are processed in
I have been reading up alot about Arc and it seems to provide some
Reading some related questions made me think about the theoretical nature of HTML. I'm
Out of curiosity/excitement I have been reading whatever information I can find about ARC
Reading MSDN (and other sources) about custom report items (CRI) for reporting services 2005.
Reading source code of my current project, I see: [self retain] in one class,
Reading this site, I've found this : [The] line private static final Foo INSTANCE
I have a few doubts regarding the use of attributes. By reading the ARC

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.