Why is my Java program leaking memory when I call run() on a Thread object?

后端 未结 3 462
情话喂你
情话喂你 2020-12-28 15:21

(Jeopardy-style question, I wish the answer had been online when I had this issue)

Using Java 1.4, I have a method that I want to run as a thread some of the time, b

3条回答
  •  春和景丽
    2020-12-28 16:00

    Let's see if we could get nearer to the core of the problem:

    If you start your program (lets say) 1000 x using start(), then 1000 x using run() in a thread, do both loose memory? If so, then your algorithm should be checked (i.e. for outer objects such as Vectors used in your Runnable).

    If there is no such memory leak as described above then you should investigate about starting parameters and memory usage of threads regarding the JVM.

提交回复
热议问题