KB-20071127-014
From Triled Wiki
- Status: opened
- author: Andrew Zhang, neil
- link:
- Description: No more than 764 threads possible as described here
- Steps to reproduce:
The following code reproduces the bug. Dalvik aborts after executing some threads. The code doesn't use synchronized mechanism, but should be enough to show the problem. If you uncomment the log statement in run() method, you'll see Dalvik aborts after printing "running 764".
public static class MyThread extends Thread {
private static int count;
public void run() {
// Log.e("andrew", "running " + ++count);
}
}
private void testThread() {
Log.e("andrew", "begin");
for(int i = 0; i < 1024; ++i) {
MyThread myThread = new MyThread();
myThread.start();
try {
Thread.sleep(1);
} catch (InterruptedException e) {
}
}
Log.e("andrew", "end");
}
