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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:53:00+00:00 2026-05-13T10:53:00+00:00

Let’s say I create an object, and that object starts a thread, and gives

  • 0

Let’s say I create an object, and that object starts a thread, and gives one of its private instance methods to ThreadStart. Later, all references to that object are gone. What happens? Is the object is never garbage collected because the thread holds a reference to it through the this pointer? On the other hand, if I use a static method, how can the thread detect that its object was garbage collected and end?

I know I shouldn’t normally make threads lifetime dependent on garbage collection. I don’t want my object to leak when it’s not disposed correctly.

  • 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-13T10:53:01+00:00Added an answer on May 13, 2026 at 10:53 am

    Creating a thread does not hold a direct reference to the object, other than any references indirectly held via the delegate. The thread uses the ThreadStart to begin running, but it does not hold a reference other than the delegate being run.

    If the method is an instance method, the object will not be garbage collected until the thread method completes. The delegate requires the reference to the object instance, and keeps it rooted. When the thread delegate completes, the object in question becomes unrooted, and is elegible for garbage collection.

    If it’s a static method, this is not an issue. There is no reference to the instance – only to the type. The instance that started the thread will not be referenced by the newly created thread – so it will run until the completion of it’s method, and then shutdown. Garbage collection of the instance is handled the same as if the thread did not exist (ie: when the other references go away, the object will be available for GC).

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

Sidebar

Ask A Question

Stats

  • Questions 307k
  • Answers 307k
  • 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 Read the section from the Swing tutorial on Concurrency which… May 13, 2026 at 9:26 pm
  • Editorial Team
    Editorial Team added an answer There are similar questions here,here answered in stackoverflow. You need… May 13, 2026 at 9:26 pm
  • Editorial Team
    Editorial Team added an answer why think so complicated? Simply make a producerMethod for those… May 13, 2026 at 9:26 pm

Related Questions

I have a French site that I want to parse, but am running into
Let's say you create a wizard in an HTML form. One button goes back,
Let's say I'm building a data access layer for an application. Typically I have
Let's say you have a class called Customer, which contains the following fields: UserName
Let me try to explain what I need. I have a server that is

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.