Skip to content

Commit 8f8ff8d

Browse files
committed
cmd/geth: handle memfixes on 32bit arch with large RAM
1 parent c989bca commit 8f8ff8d

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎cmd/geth/main.go‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,10 @@ func prepare(ctx *cli.Context) {
314314
// Check https://github.com/elastic/gosigar#supported-platforms
315315
if runtime.GOOS != "openbsd" {
316316
if err := mem.Get(); err == nil {
317+
if 32<<(^uintptr(0)>>63) == 32 && mem.Total > 2*1024*1024*1024 {
318+
log.Warn("Lowering memory allowance on 32bit arch", "available", mem.Total/1024/1024, "addressable", 2*1024)
319+
mem.Total = 2 * 1024 * 1024 * 1024
320+
}
317321
allowance := int(mem.Total / 1024 / 1024 / 3)
318322
if cache := ctx.GlobalInt(utils.CacheFlag.Name); cache > allowance {
319323
log.Warn("Sanitizing cache to Go's GC limits", "provided", cache, "updated", allowance)

0 commit comments

Comments
 (0)