We maybe need to use "unified cgroup hierarchy" as explained at Unified and Legacy Control Group Hierarchies.
 To enable this feature, add
systemd.unified_cgroup_hierarchy=1
to systemd.unified_cgroup_hierarchy=1 to GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub,
run run update-grub, and reboot Linux.
systemd.unified_cgroup_hierarchy is explained in  systemd unified cgroup hierarchysystemd unified cgroup hierarchy.
 Then added the following lines at [Service] section of your systemd unit file,
and and run systemctl daemon-reload:
Delegate=memory
MemoryHigh=8G (if you choose 8 gigabytes as the limit)
# if you choose 8 gigabytes as the limit
Delegate=memory
MemoryHigh=8G
 Explanation of "MemoryHigh" is given at
   systemd.resource-controlsystemd.resource-control.
 
                 
                 
                