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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:04:56+00:00 2026-06-17T19:04:56+00:00

update: looks like it’s not a memory leak, would someone create on based on

  • 0

update: looks like it’s not a memory leak, would someone create on based on an extension of this example?
Original question:
Suppose I create and starts a thread that does not terminate, the thread creates an object and references as long as it’s alive. See the following code. Would the JVM garbage collect x?
would this be considered a memory leak?

public class MyRunnable implements Runnable{

    public void run(){
      X x = new X();
      while(true){}
   }
}

Thread t = new Thread(new MyRunnable());
t.start();
  • 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-17T19:04:57+00:00Added an answer on June 17, 2026 at 7:04 pm

    The thread never terminates so the garbage collector will never free x. However if you never really use x it it might be optimized out. If you do use x this can not be a memory leak – you use the memory.

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

Sidebar

Related Questions

UPDATE It looks like this problem has been quietly fixed in iOS 4.3. Up
It looks like Django does not update last_login field in auth_user model when a
Update As suggested by many people, it looks like this was because of the
Update : Looks like I got caught up in a correlation that was not
UPDATE: It looks like my 13.0.1 is calling code from this diffed CharMatcher. http://code.google.com/p/guava-libraries/source/diff?spec=svn69ad96b719d7cd3d872a948d7454f17b816a21c2&r=464b0cfab7c3b6713c35e6f3ae7426542668c77b&format=side&path=/guava/src/com/google/common/base/CharMatcher.java
Update : Looks like the query does not throw any timeout. The connection is
Update: looks like this is indeed a WiX limitation - Cannot add 64bit com+
UPDATE: OK I figured it out, looks like fread has a filesize limitation, changed
I have some code to update a database table that looks like try {
This is what it looks like: artifact org.springframework:spring-core: checking for updates from glassfish-repository WARNING]

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.