Changing java memory option is not taking the OS variable TEAMCITY_SERVER_MEM_OPTS


We have a TeamCity server installed and running in a VM. Recently we had some memory issues, so we plan to increase the memory to `1.5g` from `1g` . When we set the variable TEAMCITY_SERVER_MEM_OPTS in the env TeamCity is not picking up. 


1. Version build 99542

2. OS: Amazone Linux VERSION_ID="2018.03"

3. Teamcity is running as a `xyz` user and env is set for that profile correctly



Changed the value in the restart script 



When we upgrade the teamcity the binaries will be overriden by the new scripts. 


How can we make sure the memory setting in the environment variable is getting used ? 


Hi Ajith,

You shouldn't modify any scripts in the bin directory of TeamCity installation. The default scripts will always correctly pick up the value of this variable. 

When we set the variable TEAMCITY_SERVER_MEM_OPTS in the env TeamCity is not picking up. 

Exactly how do you start the TeamCity server? Do you use the below command? Is it the original script, or it was modified? Do you use any tools like systemd to automatically start it? If so, what's the service description?

$ start

On a side note, if your server is not really small, you should consider using the 2048m value, because 1536m is just above the minimum recommended setting for 64-bit Java (1024m). You can read more about recommended memory settings in this article


Hello Mikhail,

Whenever we change the environment variable we have to restart from the cli ? so memory settings will be set up before teamcity starts,as they are used to run the JVM. I was using UI to restart that's why it was not picking up ? 

Thanks for the suggestion on memory size.




Hi Ajith,

That's right. When you restart the server using the 'Restart Server' button on the 'Administration | Diagnostics' page, any changes in the environmental variables are ignored.

The restart process doesn't kill the top-level process that starts the server ( Since the parent process doesn't restart, neither it nor any of its child processes are aware of any environmental changes. 

In order for the new value to be picked up, you should stop the server ( stop) and then start it again ( start).


Please sign in to leave a comment.