Monthly Archives: November 2010

SRCDS Memory Usage

So you’ve got a server, and (over time?) it seems to consume a large amount of virtual memory?

blah 22011 3.9 6.5 1368616 165440 ? Rl 04:02 31:40 ./srcds_linux -game cstrike -console +ip 1.2.3.4 -port 27015 +tv_port 28020 +maxplayers 12 +map de_dust2 -autoupdate

See the ’1368616′ number? That’s your virtual memory aka mapped memory. That number is usually larger on glibc 2.3.2+ because of NPTL’s stack size, which is usually this (x86_64):

stack size (kbytes, -s) 8192

[gary@dallas ~]$ ulimit -s
8192

That is just way too large for gameservers. AIX and Solaris use 96 and 64, respectively, and 8192 is just way too large.

[gary@dallas ~]$ ulimit -s 512
blah 31008 6.7 0.5 126440 21528 pts/4 Sl+ 17:20 01:40 ./srcds_linux -game cstrike -console +ip 1.2.3.4 -port 27015 +tv_port 28020 +maxplayers 12 +map de_dust2 -autoupdate

Much better:

Old:
mapped: 368616K writeable/private: 326688K shared: 0K
New:
mapped: 168044K writeable/private: 130164K shared: 0K