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

The Archive Base Latest Questions

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

When you do a release, you do not immediately remove the memory. I used

  • 0

When you do a release, you do not immediately remove the memory. I used this code and I can see the memory before and after the use of release and it do not change. Ok, it will be release after some time.

But, what can I do for release all memory I can before start a library that will use a lot of memory? Or how can I immediately release memory?

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

    Memory Management is a big thing in iOS but this tidbit of information helped me a lot during my development.

    “Each object has a “retain count” which is increased by calling “retain” and decreased by calling “release”. Once the retain count hits 0, the object is released and the memory can be used for something else.

    You can “autorelease” objects. This means the retain count isn’t immediately decreased, but is decreased the next time the current autorelease pool is drained.

    iOS apps have an event loop in which your code runs. After each iteration of the event loop, the autorelease pool is drained. Any object with a retain count of 0 is released.

    By default, autoreleased objects are returned by methods that don’t begin with new, copy, mutableCopy, retain or init. This means you can use them immediately but if you don’t retain them the object will be gone on the next iteration of the run loop.

    If you fail to release retained objects but no longer reference them then you will have a memory leak, this can be detected by the leaks tool in Instruments.

    One strategy is to autorelease everything returned by the above named methods and store objects in retain properties (or copy for strings). In your object’s dealloc method, set all your properties to nil. Setting a retain/copy property to nil releases the object that it currently points to. As long as you don’t have any circular references (avoided by not using retain properties for “parent” objects such as delegates), you will never encounter any leaks.”

    here is the link to the thread for this information

    http://www.quora.com/What-is-the-best-way-to-understand-memory-management-in-iOS-development

    It’s a good thread with some useful code examples as well as other references.

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

Sidebar

Related Questions

I found this PECL package called threads , but there is not a release
I often see when we release ab object we immediately set it to nil.
Not immediately seeing where to download legacy versions of the iphone SDKs. I can
I am downright annoyed because the Quartz release I'm importing does not have a
When I do a release build with gcc (i.e. I do not specify -g
Does NSProxy really implement -autorelease and -release ? If not, do I need to
I like a library released under BSD license . This library is not actively
i.e. would cause the object to be released immediately and not have to be
I know this question looks like a dupe: I checked and it's not In
I am pushing a UIViewController onto a UINavigationController . This view controller immediately starts

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.