Filing Bugs‎ > ‎

Generating a Thread Dump

A thread dump is a printout of all the threads running in the JVM, and for each thread, a printout of all the stackframes.
This makes it easy to see what the IDE is busy doing. Especially if you generate a couple of thread dumps a few seconds apart.

When you report bugs where the IDE is extremely busy with a pegged CPU, or where the IDE appears to have frozen, a thread dump can pinpoint either what code is doing a lot of work, or which threads are contending over resources and causing a deadlock.

The JDK ships with a tool named "jstack" which can be used to generate a thread dump. First you'll need to find the process id of the Android Studio process. You can use the "jps" command for that. (Both jstack and jps are in the bin directory of the JDK. If you have multiple JDKs installed, you should use the same version here as the one you are running Android Studio with, and you can see what version that is in Android Studio's About box.)
On Linux, Mac:
$ jps -mv | grep studio
For Windows:
$ jps -mv | findstr studio

For example, this will print out a long line like this:

$ jps -mv | grep studio
37605 -Dfile.encoding=UTF-8 -ea -Djna.nosys=true ...

where (for this specific case) the first number on the left, 37605, is the process id.

Next, you can generate a thread dump and save it to the file dump.txt
$ jstack -l pid >> dump.txt

If that does not work, there are some additional platform-specific ways you can generate a thread dump; see IntelliJ Support for detailed instructions.