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 diff --git a/trie/sync_bloom.go b/trie/sync_bloom.go index 7b5b7488a..2182d1c43 100644 --- a/trie/sync_bloom.go +++ b/trie/sync_bloom.go @@ -70,7 +70,7 @@ func NewSyncBloom(memory uint64, database ethdb.Iteratee) *SyncBloom { // Create the bloom filter to track known trie nodes bloom, err := bloomfilter.New(memory*1024*1024*8, 3) if err != nil { - panic(fmt.Sprintf("failed to create bloom: %v", err)) // Can't happen, here for sanity + panic(fmt.Sprintf("failed to create bloom: %v", err)) } log.Info("Allocated fast sync bloom", "size", common.StorageSize(memory*1024*1024))