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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:50:36+00:00 2026-06-13T17:50:36+00:00

I am using threaded timer which is creating new instance and call a method

  • 0

I am using threaded timer which is creating new instance and call a method like below,

Timer_tick()
{
   Car C;
   C=new Car();
   C.Start()      ///  this will take time to complete
}

My question is, there is another thread coming with next timer tick and perform same operation.
Then the second thread remove the reference from first Car instance & it will call the start method on new Car instance, since first object does not finished his start method (still in progress) but it doesn’t have the “C” variable reference anymore.
Will this create any problem to first instance Start() method completeness or execution.
Can it be collected by GC?

  • 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-13T17:50:37+00:00Added an answer on June 13, 2026 at 5:50 pm

    The Car instance is local to that particular call of the Timer_tick() function. Subsequent calls by other threads operate on their own instances of the Car object.

    However, it doesn’t look like you’re doing anything with the car after the function exits, it will eventually get garbage collected without having done anything to it besides running the start function. Is that what you intended?

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

Sidebar

Related Questions

I want this method to be threaded out so I can set a timer
I was thinking about creating a class (like String, StringBuffer etc). This can be
I want to call a Business layer method from a Windows service (done using
I'm about to start a program using Python which is mostly doing polling, it
I was using HashMap before like public Map<SocketChannel, UserProfile> clients = new HashMap<SocketChannel, UserProfile>();
I'm using the threaded version of FFTW (a FFT library) to try to speed
I wrote multi-threaded FTP uploader on C#.NET using libcurl.NET. Everything works fine on my
My QT-based single-threaded console app running on Linux parses JSON strings using Boost, and
I've been writing a multi-threaded DLL for database access using ADO/ODBC for use with
I am trying to debug a multi-threaded Android app on a 2.3.6 device using

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.