aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth/main.go
diff options
context:
space:
mode:
authorGuillaume Ballet <gballet@gmail.com>2019-07-05 18:13:21 +0800
committerPéter Szilágyi <peterke@gmail.com>2019-07-05 18:13:21 +0800
commitdcc4adfcd76753c9bf567ed1b6fc352f898638e7 (patch)
tree3f7ba2a04b325e575a551648e3c348c238198299 /cmd/geth/main.go
parentd9c75cd10e94da21d7f57e2a7528b08154cd486b (diff)
downloadgo-tangerine-dcc4adfcd76753c9bf567ed1b6fc352f898638e7.tar
go-tangerine-dcc4adfcd76753c9bf567ed1b6fc352f898638e7.tar.gz
go-tangerine-dcc4adfcd76753c9bf567ed1b6fc352f898638e7.tar.bz2
go-tangerine-dcc4adfcd76753c9bf567ed1b6fc352f898638e7.tar.lz
go-tangerine-dcc4adfcd76753c9bf567ed1b6fc352f898638e7.tar.xz
go-tangerine-dcc4adfcd76753c9bf567ed1b6fc352f898638e7.tar.zst
go-tangerine-dcc4adfcd76753c9bf567ed1b6fc352f898638e7.zip
cmd/geth: wrong memory size sanitizing on OpenBSD (#19793)
Diffstat (limited to 'cmd/geth/main.go')
-rw-r--r--cmd/geth/main.go15
1 files changed, 10 insertions, 5 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index 414900b45..fd8f29421 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -21,6 +21,7 @@ import (
"fmt"
"math"
"os"
+ "runtime"
godebug "runtime/debug"
"sort"
"strconv"
@@ -256,11 +257,15 @@ func init() {
}
// Cap the cache allowance and tune the garbage collector
var mem gosigar.Mem
- if err := mem.Get(); err == nil {
- allowance := int(mem.Total / 1024 / 1024 / 3)
- if cache := ctx.GlobalInt(utils.CacheFlag.Name); cache > allowance {
- log.Warn("Sanitizing cache to Go's GC limits", "provided", cache, "updated", allowance)
- ctx.GlobalSet(utils.CacheFlag.Name, strconv.Itoa(allowance))
+ // Workaround until OpenBSD support lands into gosigar
+ // Check https://github.com/elastic/gosigar#supported-platforms
+ if runtime.GOOS != "openbsd" {
+ if err := mem.Get(); err == nil {
+ allowance := int(mem.Total / 1024 / 1024 / 3)
+ if cache := ctx.GlobalInt(utils.CacheFlag.Name); cache > allowance {
+ log.Warn("Sanitizing cache to Go's GC limits", "provided", cache, "updated", allowance)
+ ctx.GlobalSet(utils.CacheFlag.Name, strconv.Itoa(allowance))
+ }
}
}
// Ensure Go's GC ignores the database cache for trigger percentage