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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T12:19:28+00:00 2026-05-21T12:19:28+00:00

I want to check if an object has some count or not Here is

  • 0

I want to check if an object has some count or not Here is my testing code

NSMutableArray  *array=[[NSMutableArray alloc]init];

    if(array)
    {
        NSLog(@"hiiiiiii"); 
    }

CASE-2

NSMutableArray  *array=[[NSMutableArray alloc]init];
    [array release];
    if(array)
    {
        NSLog(@"hiiiiiii"); 
    }

Here in both cases i got same output as printed “hiiiiiii”.

Can anyone tell me how will i check if my object need to release or already released.

I know that i should have track of my object’s counters but i am at a stage where my code is too much complexed and i need help..

Please help..

ALso tell that how much memory leak is allowed by apple?

  • 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-21T12:19:28+00:00Added an answer on May 21, 2026 at 12:19 pm

    There is no way to check if you “should” release an object. Doing something like “if(object)” only checks the pointer to the object. It will return true even if the object it was pointing to was destroyed a long time ago. This is what happens in your second case. The object is destroyed when you call release, but the pointer is still pointing at something, so it returns true. It will only return false if the pointer is set to nil.

    However, there is a simple set of rules for calling release. If you ever call “alloc”, “new”, “copy”, “mutableCopy” or “retain” on object, you must always call “release” or “autorelease” on it. That will prevent any memory leaks.

    Apple does not have a publicized amount of memory leaks allowed. It is always safest to eliminate any known memory leaks; plus, it will mean better performance for your customers.

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

Sidebar

Related Questions

I regularly want to check if an object has a member or not. An
I want to check the type of an Object. How can I do that?
I want to check if a variable has a valid year using a regular
I have a bunch of methods which I want to check some metadata of,
I have some Scala code roughly analogous to this: object Foo { val thingA
I have a data model object User . My app also has some other
I want to check out all files in all subdirectories of a specified folder.
I want to check for the existence of a table with a given ID
I want to check the login status of a user through an ajax request.
I want to check for duplicated words right next to each other, but even

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.