This parameter allows to set soft memory limit for Go GC. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
23 lines
475 B
Go
23 lines
475 B
Go
package runtime
|
|
|
|
import (
|
|
"math"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config"
|
|
)
|
|
|
|
const (
|
|
subsection = "runtime"
|
|
memoryLimitDefault = math.MaxInt64
|
|
)
|
|
|
|
// GCMemoryLimitBytes returns the value of "soft_memory_limit" config parameter from "runtime" section.
|
|
func GCMemoryLimitBytes(c *config.Config) int64 {
|
|
l := config.SizeInBytesSafe(c.Sub(subsection), "soft_memory_limit")
|
|
|
|
if l > 0 {
|
|
return int64(l)
|
|
}
|
|
|
|
return memoryLimitDefault
|
|
}
|