mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-01 23:10:01 +00:00
cd1611362f
Bumps [github.com/KimMachineGun/automemlimit](https://github.com/KimMachineGun/automemlimit) from 0.3.0 to 0.4.0. - [Commits](https://github.com/KimMachineGun/automemlimit/compare/v0.3.0...v0.4.0) --- updated-dependencies: - dependency-name: github.com/KimMachineGun/automemlimit dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
---|---|---|
.. | ||
memlimit | ||
.gitignore | ||
automemlimit.go | ||
LICENSE | ||
README.md |
automemlimit
Automatically set GOMEMLIMIT
to match Linux cgroups(7) memory limit.
See more details about GOMEMLIMIT
here.
Installation
go get github.com/KimMachineGun/automemlimit@latest
Usage
package main
// By default, it sets `GOMEMLIMIT` to 90% of cgroup's memory limit.
// You can find more details of its behavior from the doc comment of memlimit.SetGoMemLimitWithEnv.
import _ "github.com/KimMachineGun/automemlimit"
or
package main
import "github.com/KimMachineGun/automemlimit/memlimit"
func init() {
memlimit.SetGoMemLimitWithOpts(
memlimit.WithRatio(0.9),
memlimit.WithEnv(),
memlimit.WithProvider(memlimit.FromCgroup),
)
memlimit.SetGoMemLimitWithEnv()
memlimit.SetGoMemLimit(0.9)
memlimit.SetGoMemLimitWithProvider(memlimit.Limit(1024*1024), 0.9)
memlimit.SetGoMemLimitWithProvider(memlimit.FromCgroup, 0.9)
memlimit.SetGoMemLimitWithProvider(memlimit.FromCgroupV1, 0.9)
memlimit.SetGoMemLimitWithProvider(memlimit.FromCgroupHybrid, 0.9)
memlimit.SetGoMemLimitWithProvider(memlimit.FromCgroupV2, 0.9)
}