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();