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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:47:07+00:00 2026-05-22T20:47:07+00:00

I make a object that use the camera to decode a bar code. If

  • 0

I make a object that use the camera to decode a bar code. If it was successful it send a delegate message to next action, if not, it only go out, and next screen start to work.

If am I in the last command of the object, can I send [self release] to free the memory? But, the problem is: the retainCount can be more than on one?

Like

  ObjectToDealloc *test = [[ObjectToDealloc alloc] init];
  [test doYourJob];
  //can't release here, it broke my program

in the last thing that this object do, it run:

  -(void)destroyYourself {
     [self release];
     [self dealloc];
  }

This will work? I will release the memory? Or I have to make “test” in global visibility (not only function visibility) and do a:

   [test release];
  • 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-22T20:47:07+00:00Added an answer on May 22, 2026 at 8:47 pm

    There are a couple of instances where I have seen classes that retain themselves in order to keep themselves around until they perform work. NEVER, EVER, EVER CALL DEALLOC*. Dealloc is not for you, but the runtime. If you no longer need an object, just appropriately release it. It is only the runtime’s duty to call that method.

    Here’s an example of some code that I regularly use where the object retains itself and then appropriately releases itself when done with its work: UIAlertView+Blocks This code does this because the object is suppose to stick around, even after it has been released by the instantiating class so that it can run and finish the blocks it was given to execute.

    *Except when calling your super’s dealloc within your own dealloc, but this goes without saying.

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

Sidebar

Related Questions

I have a singleton object that use another object (not singleton), to require some
I'm trying to make an application that keeps an object model in sync with
Does it make sense to use interfaces for your domain object factories by default,
I wanna make use of the Ternary Operator with an object. if($msg == 'hello'){
I have some object classes that use inheritance. It seems that I can only
I'm trying to make an object that handles basic time related functions. I want
What happens when I use an ObjectInputStream to read in a serialized object that
I need to make a Javascript object that would behave as an associative array,
It seems that the decision to make your objects fully cognizant of their roles
I am storing objects in a buffer. Now I know that I cannot make

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.