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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:19:03+00:00 2026-05-11T17:19:03+00:00

There are two Objects A and B. A creates B and retains it. B

  • 0

There are two Objects A and B. A creates B and retains it. B has an instance variable that points to A, retaining it. So both retain eachother. Some people say, that this strong connection can’t be broken ever again.

But is that really the case?

If B would release A, then A could easily release B, and so B would be deallocated. A would be deallocated as soon as it’s other owner (I guess there must be someone) releases it.

Or does this problem only apply in a case where A does not create B, but just holds a strong reference to it through retaining it in an instance variable? I still don’t see why that connection could not be broken up again.

  • 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-11T17:19:03+00:00Added an answer on May 11, 2026 at 5:19 pm

    Cycles aren’t bad, but they are often avoided because they can make it tricky to ensure you haven’t got memory leaks. Leaks occur especially when objects are ‘reference counted’. In a language or system that uses reference counting, an object keeps track of the number of references pointing at it. Every time a reference is deleted, the count goes down, when the count gets to zero, there are no references and so the object can be deleted.

    This usually takes care of itself and works ok without any careful thinking. If you’ve got a group of objects with no cycles and you drop your reference to the root object, then it will be deleted, this means references it has to objects it owns will be dropped, the objects being referenced will have their reference counts go to zero. They’ll be deleted and the cascade will cause all objects to be deleted.

    But… if you have a cycle, this cascade doesn’t work. You may have a group of objects and you don’t want them any more, so you drop the only reference you have to these objects, but because there is a cycle the objects reference each other. This means their reference counts never go to zero, and they don’t get deleted. This is a memory leak.

    Clearly, you can do some careful management and break the cycles before you drop your reference to a group of objects you don’t want any more. But… as I just said, this takes careful management. It’s very easy to get wrong. This is one of the main reasons that memory leaks occur.

    To avoid the risk of leaks and the tricky job of breaking cycles correctly when you no longer need a group of objects, programmers usually try to avoid cycles. This becomes more important on big projects with many programmers where no one person understands the whole system. If there were cycles, the programmers would have to watch out and spend a long time studying each others code to avoid cycles.

    Some languages with garbage collectors (eg C#) can delete a group of objects that are no longer needed even if the group contains cycles.

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

Sidebar

Ask A Question

Stats

  • Questions 170k
  • Answers 170k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I am currently doing dynamic server-side clustering of about 2,000… May 12, 2026 at 2:09 pm
  • Editorial Team
    Editorial Team added an answer It does kind of what it says. Expect many calls… May 12, 2026 at 2:09 pm
  • Editorial Team
    Editorial Team added an answer ", ".join('"{0}"'.format(i) for i in tup) or ", ".join('"%s"' %… May 12, 2026 at 2:09 pm

Related Questions

In Python, there are examples of built-in classes with highly constrained instances. For example,
I'm using castle windsor for a pet-project I'm working on. I'm starting to notice
I am writing a multi-threaded solution in Java to connect two systems, A &
I'm writing a daemon to monitor creation of new objects, which adds rows to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.