We have 342 RHEL 8.6 machines and all machines are with the same situation when systemctl service takes much more memory then the PID itself :
systemctl status presto.service ● presto.service - Perforce Server . . . Main PID: 3683651 (presto-server) Tasks: 284 (limit: 3297083) Memory: 298.1G CGroup: /system.slice/presto.service While the presto PID itself consume around 32G:
more /sys/fs/cgroup/memory/system.slice/presto.service/memory.usage_in_bytes 31329787904 --> ~32G We can also check how much presto PID consuming by ps aux --sort=-%mem | head.
In any case we can do workaround as the follwing in order to limit the service as:
[Service] User=presto Group=presto_group MemoryMax=64000M MemoryHigh=60000M But before above setting we want to know how it can be that systemctl show consuming of ~300G while the presto PID itself takes much less - 32G
Here the command that systemctl controlled
# The type should always be set to "forking" to support # multiple Perforce processes: Type=forking # The command used to start Perforce: ExecStart=/home/presto/server/bin/launcher start ExecStop=/home/presto/server/bin/launcher stop Restart=always RestartSec=30s StartLimitInterval=0 StartLimitBurst=5 RemainAfterExit=no LimitNOFILE=65536 [Install] # Describes the target for this service -- this will always # be 'multi-user.target': WantedBy=multi-user.target more /sys/fs/cgroup/memory/memory.stat 
memory.statfile of that cgroup?