The Prometheus eco-system recently implements a logic to auto-detect memory limits from cgroups and set GOMEMLIMIT based on the limits. As I know, they are using https://github.com/KimMachineGun/automemlimit