You are viewing the documentation of TeamCity 2018.x, which is not the most recently released version of TeamCity.
View this page in the latest documentation or refer to the listing to choose the documentation corresponding to your TeamCity version.


Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


  • Determine what process encounters the error (the actual building process, the TeamCity server, or the TeamCity agent). You can track memory and CPU usage by TeamCity with the charts on the Administration | Server Administration | Diagnostics page of your TeamCity web UI.
  • If the server is to blame, please check you have increased memory settings from the default ones for using the server in production (see the section).
  • If the build process is to blame, set "JVM Command Line Parameters" settings in the build runner.  Increase value for '-Xmx' JVM option, like -Xmx1200m, e.g. Java Inspections builds may specifically need to increase -Xmx value.
  • Anchor
    If the TeamCity server is to blame and increasing the memory size does not help, please report the case for us to investigate. For this, while the server is high on memory consumption, take several server thread dumps as described above, get the memory dump (see below) and all the server logs including threadDumps-* sub-directories, archive the results and send them to us for further analysis. Make sure that Xmx setting is less than 8Gb before getting the dump:
    • to get if a memory dump (hprof file) automatically when an OutOfMemory error occurs, add the following server JVM option: -XX:+HeapDumpOnOutOfMemoryError. When OOM error occurs next time, the is created automatically the java_xxx.hprof file will is be created in the process startup directory (<TeamCity Home>/bin or <TeamCity Agent home>/bin);
    • for the server, you can also take memory dump manually when the memory usage is at its peak. Go to the Administration | Server Administration | Diagnostics page of your TeamCity web UI and click Dump Memory Snapshot.
    • another approach to take a memory dump manually is to use the jmap standard JVM command line utility of the full JVM installation of the same version as the Java used by the process. Example command line is:
      jmap -dump:file=<file_on_disk_to_save_dump_into>.hprof <pid_of_the_process>