Skip to content

Instantly share code, notes, and snippets.

@lichengwu
Created June 2, 2012 15:25
Show Gist options
  • Save lichengwu/2858816 to your computer and use it in GitHub Desktop.
Save lichengwu/2858816 to your computer and use it in GitHub Desktop.
diff Xss & ThreadStackSize
import java.util.concurrent.TimeUnit;
import sun.dc.pr.PathDasher;
public class Crash {
public static void main(String[] args) {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
TimeUnit.SECONDS.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
thread.setName("oliver");
thread.start();
PathDasher dasher = new PathDasher(null);
}
}
$ java -version
java version "1.7.0_03"
Java(TM) SE Runtime Environment (build 1.7.0_03-b05)
Java HotSpot(TM) 64-Bit Server VM (build 22.1-b02, mixed mode)
$ java Crash
Java Threads: ( => current thread )
0x000000000686e000 JavaThread "oliver" [_thread_blocked, id=7568, stack(0x0000000007b70000,0x0000000007c70000)]
=>0x000000000010c800 JavaThread "main" [_thread_in_vm, id=6676, stack(0x0000000002230000,0x0000000002330000)]
$ java -Xss5m -XX:ThreadStackSize=3m Crash
Java Threads: ( => current thread )
0x0000000006b7d000 JavaThread "oliver" [_thread_blocked, id=7984, stack(0x00000004fff30000,0x00000005bff30000)]
=>0x00000000000fc800 JavaThread "main" [_thread_in_vm, id=4480, stack(0x0000000002290000,0x0000000002790000)]
$ java -Xss3m -XX:ThreadStackSize=5m Crash
Java Threads: ( => current thread )
0x00000000069ca000 JavaThread "oliver" [_thread_blocked, id=5652, stack(0x00000001bfcb0000,0x00000001ffcb0000)]
=>0x00000000002ec800 JavaThread "main" [_thread_in_vm, id=7004, stack(0x0000000002430000,0x0000000002730000)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment