automemlimit

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2022 License: MIT Imports: 5 Imported by: 87

README

automemlimit

Automatically set GOMEMLIMIT to match Linux container memory quota.

Installation

go get -u github.com/KimMachineGun/automemlimit

Usage

package main

import _ "github.com/KimMachineGun/automemlimit"

or

package main

import "github.com/KimMachineGun/automemlimit/memlimit"

func init() {
	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.FromCgroupV2, 0.9)
}

Documentation

Index

Constants

View Source
const (
	EnvGOMEMLIMIT   = "GOMEMLIMIT"
	EnvAUTOMEMLIMIT = "AUTOMEMLIMIT"

	DefaultAUTOMEMLIMIT = 0.9
)

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
examples
dynamic module
gosigar module
logger module
system module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL