Never enough memory to perform Inspection

I've been trying to use the "Analyze -> Inspect..." tools on a set of about 10 uncommitted files. However, each time I try, IntelliJ (v11.0, build 111.69) runs into heap space limits.

I have incrementally increased the max heap space to 1200M (running on 64-bit Windows 7 with 4G RAM), which is near the limit for a 32-bit Java VM.

What is the recommended way to run inspections on large code bases? Should I try to force IntelliJ to run in a 64-bit Java VM and increase the heap space to 2-3GB?



You're almost certainly running into a bug. You might need a 64-bit JVM to run inspections on a project that contains tens of thousands of classes, but it should never be needed for inspecting 10 files.
Please capture and upload a memory snapshot file (.hprof) as described in


As it turns out, the Inspection dialog was getting stuck on the same file each time, even when I specified a single Java source file as the "Inspection Scope". The file was a very large XML file ("altos.xml", about 800MB) that was located in the top-level project directory.

The file was not referenced by the code base in any way - not in string literals or even from JUnit test cases. But for some reason, any time I started an analysis, that file was included in the analysis. IntelliJ would spend about 5 minutes with the progress dialog: "Perform backward analysis - ...\altos.xml"

Once that file was removed from the project directory, the code inspection was able to complete using a more reasonable amount of memory in a reasonable amount of time.

Not sure if the inadvertent inclusion of the XML file in the inspection should be considered a bug or a feature.



This is not exactly a bug. Certain inspections need to know whether code is referenced from other places in the codebase, and they don't restrict this search to a particular scope.


Please sign in to leave a comment.