lib/memory: attempt #2 to determine memory limit inside LXC container

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/84
This commit is contained in:
Aliaksandr Valialkin 2019-06-28 18:08:09 +03:00
parent 79ac02ba74
commit 7b59466667

View file

@ -31,6 +31,15 @@ func sysTotalMemory() int {
if err != nil { if err != nil {
return totalMem return totalMem
} }
if mem != totalMem {
return mem
}
// Try reading LXC memory limit, since it looks like the cgroup limit doesn't work
mem, err = readLXCMemoryLimit(totalMem)
if err != nil {
return totalMem
}
return mem return mem
} }