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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:38:25+00:00 2026-06-05T10:38:25+00:00

i am trying to understand something. in class A , i am creating an

  • 0

i am trying to understand something.
in class A , i am creating an instance of classB , which there -in B , there is a timer, that ALWAYS repeat, and he fire a recording and playing system-forever.

in class A, i create the instance of B with :

recordMachine *recMinst=[[recordMachine alloc]init];
[recMinst startMachine];
[recMinst release];

the thing is, that in classB there are instance variables in the interface, such as the player,recorder pointers, and other integers.

the question is, how this classB continue to work, after i release the instance in A ??
doesnt A create a place in memory to store all the B instance variables and when i release it -they disappear ?

  • 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-06-05T10:38:27+00:00Added an answer on June 5, 2026 at 10:38 am

    doesnt A create a place in memory to store all the B instance
    variables and when i release it -they disappear ?

    Yes and no, release does not work like C++ delete for example, it does not delete the object and clean its memory, but only decrease its reference count. If another object is holding onto it, then it won’t get deallocated until that other object has also called release on it.

    the question is, how this classB continue to work, after i release the
    instance in A ??

    The only explanation as to why B continues to work is because some other object is holding onto it.

    You mention class B uses a timer (most likely an NSTimer) which you would have passed your B instance to. Thus NSTimer is keeping a reference to your B object and preventing it from getting destroyed.

    Check the ref count on your instance to be sure.

    NSTimer documentation says “The target object is retained by the timer and released when the timer is invalidated.”

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

Sidebar

Related Questions

Trying to understand something that I don't know how to describe because I don't
trying to understand and learn how to write packages... testing with something i've always
Trying to understand something. I created a d:\svn\repository on my server. I committed folders
I'm trying to understand on a deeper level if I'm missing something as to
I am trying to understand the difference between this: if (isset($_POST['Submit'])) { //do something
I'm trying to understand REST. Under REST a GET must not trigger something transactional
Trying to understand upcasting in Java. Recently observed strange behavior. Example: public class A
Trying to understand the math of this code snippet. A token is provided which
I'm very new to Ruby and now trying to understand something about metaprogramming. I
I think I'm going a bit crazy when trying to understand instance variables in

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.