Linux systemd and Service Processes/Set memory cap on service

Limit service memory through cgroup controls.

Section: Transient Units and Resource Controls

Set memory cap on service

bash
bash
sudo systemctl set-property myjob.service MemoryMax=1G
Explanation

Limit service memory through cgroup controls.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Transient Units and Resource Controls
Set CPU quota on service
Apply runtime resource-control properties to a unit.
OpenIn sheetbashsame section
Run process in transient scope
Run an interactive process in its own transient scope unit.
OpenIn sheetbashsame section
Run transient service
Launch a one-off command as a transient service unit.
OpenIn sheetbashsame section
Show service status
Show status, recent logs, and the service main PID.
OpenIn sheetbash1 tag match
Start a service
Start a service unit.
OpenIn sheetbash1 tag match
Show main PID only
Extract the tracked main PID for a unit.
OpenIn sheetbash1 tag match