Update VCS from mecurial to Git results in an error java.lang.OutOfMemoryError: Java heap space, VCS root


Hi All,


I am running team city version 2019.2.4, we recently migrated our source control from mercurial to git. We have added a new VCS root to point to the new git repo, but are getting the following error when kicking off a build:


Failed to collect changes, error: Error collecting changes for VCS repository '"<VCS Name>" {instance id=48, parent internal id=8, parent id=<VCS ID>, description: "https:/<Git UserName AND URL>#refs/heads/master"}'
java.lang.OutOfMemoryError: Java heap space, VCS root: "S<VCS Name>" {instance id=48, parent internal id=8, parent id=<VCS ID>, description: "https://<Git UserName AND URL>#refs/heads/master"}


we have tried updating a few of the default config properties in the internal.properties file with no luck. we have also added the following environment variable TEAMCITY_SERVER_MEM_OPTS with the value -Xmx1024m with no luck.


Any advice or links to other resources that might help would be appreciated :)



Comment actions Permalink


Please try to set Xmx to 2gb. If it does not help please check that this Xmx was indeed passed to TeamCity. You can check JVM arguments on Administraiton -> Diagnostics page. If everything is ok but error still happens, then we'll need teamcity-vcs.log.

Comment actions Permalink

Hi Pavel,


thanks for getting back to us so quickly, we have 32 bit Team City installed (is there a 64 bit version of team city?) and 32 bit Java runtime installed, is updating the value to 2gb possible?






Comment actions Permalink

Hi all,


just to extend on my comments above I tried updating the TEAMCITY_SERVER_MEM_OPTS environment variable to be -Xmx2048m, however after restarting the machine the team city service does not start (its set to start automatically). After starting the service manually we try to hit the front end which gives us a service unavailable error.


I should also note that we are running team city on a windows server 2016 which has 32 bit team city and 32 bit java run time installed.


As per your doco for 2019.2 found here: https://www.jetbrains.com/help/teamcity/2019.2/installing-and-configuring-the-teamcity-server.html can you confirm if it is possible to allocate more the 1024mb of memory to team city for our scenario:

"recommended setting for medium server use: for 32-bit Java -Xmx1024m. Greater settings with the 32-bit Java can cause an OutOfMemoryError with "Native memory allocation (malloc) failed" JVM crashes or "Unable to create new native thread" messages. For 64-bit Java -Xmx1536m."


"the 32-bit JVM can reliably work with up to 1Gb heap memory (Xmx1024m). (This can be increased to -Xmx1200m, but JVM under Windows might crash occasionally with this setting.) If more memory is necessary, the 64-bit JVM should be used with not less than 2.5Gb assigned (-Xmx2500m)."

Comment actions Permalink

In fact, 2019.2.x already comes with 64-bit JVM, but you probably performed upgrade via auto-update feature and unfortunately in this case JVM is not getting updated. Please follow these instructions about JVM update: https://www.jetbrains.com/help/teamcity/installing-and-configuring-the-teamcity-server.html#InstallingandConfiguringtheTeamCityServer-Using64bitJavatoRunTeamCityServer

Yes your server should work fine with Xmx2g once you update your JVM. Will fix the discrepancies in our documentation, thanks for noticing!



Please sign in to leave a comment.