每次創建新的線程時,它都會被添加到主線程組中,甚至我會將它仍然存在於主線程組中的線程清零,從而導致內存泄漏。請幫助如何從線程組中刪除線程
更新
public void surfaceDestroyed(SurfaceHolder holder) {
Log.d("mThread", "Surface Destroyed Called");
getHolder().removeCallback(this);
boolean retry = true;
_thread.setRunning(false);
while (retry) {
try {
Log.d("mThread", "b4 Interrupted");
_thread.interrupt();
Log.d("mThread", "b4 thread group Interrupted");
_thread.getThreadGroup().interrupt();
Log.d("mThread", "b4 join");
_thread.join();
retry = false;
} catch (InterruptedException e) {
Log.d("mThread", "Interrupted");
Thread.currentThread().interrupt();
_thread.getThreadGroup().list();
_thread = null;//======>here nulling thread
break;
}
}
}
我沒有太多的代碼顯示。請幫助 – 2011-06-10 10:17:30
',甚至我將它仍然存在於主線程組中的線程清空。這是什麼意思? – 2011-06-10 10:24:15
親愛的走鵑我已經更新了代碼,請幫助我 – 2011-06-10 10:36:06