前言
- geth version
Geth
Version: 1.9.7-stable
Git Commit: a718daa674a2e23cb0c8a6789f7e5467e705bbbd
Git Commit Date: 20191107
Architecture: 386
Protocol Versions: [64 63]
Network Id: 1
Go Version: go1.13.4
Operating System: windows
GOPATH=
GOROOT=C:\go
- windows 7
错误信息
INFO [11-22|11:09:41.205] Starting peer-to-peer node instance=Geth/v1.9.7-stable-a718daa6/windows-386/go1.13.4
INFO [11-22|11:09:41.205] Allocated trie memory caches clean=674.00MiB dirty=674.00MiB
INFO [11-22|11:09:41.205] Allocated cache and file handles database=D:\\go-ethereum\\privNetwork\\data\\geth\\chaindata cache=1.32GiB handles=8192
INFO [11-22|11:09:41.253] Opened ancient database database=D:\\go-ethereum\\privNetwork\\data\\geth\\chaindata\\ancient
INFO [11-22|11:09:41.254] Initialised chain configuration config="{ChainID: 12345 Homestead: 0 DAO: <nil> DAOSupport: false EIP150: 0 EIP155: 0 EIP158: 0 Byzantium: 0 Constantinople: 0 Petersburg: 0 Istanbul: <nil> Engine: unknown}"
INFO [11-22|11:09:41.254] Disk storage enabled for ethash caches dir=D:\\go-ethereum\\privNetwork\\data\\geth\\ethash count=3
INFO [11-22|11:09:41.254] Disk storage enabled for ethash DAGs dir=C:\\Users\\Administrator\\AppData\\Local\\Ethash count=2
INFO [11-22|11:09:41.254] Initialising Ethereum protocol versions="[64 63]" network=1 dbversion=7
INFO [11-22|11:09:41.495] Loaded most recent local header number=0 hash=ffaf2b…905286 td=131072 age=50y7mo1w
INFO [11-22|11:09:41.495] Loaded most recent local full block number=0 hash=ffaf2b…905286 td=131072 age=50y7mo1w
INFO [11-22|11:09:41.495] Loaded most recent local fast block number=0 hash=ffaf2b…905286 td=131072 age=50y7mo1w
INFO [11-22|11:09:41.496] Loaded local transaction journal transactions=0 dropped=0
INFO [11-22|11:09:41.499] Regenerated local transaction journal transactions=0 accounts=0
runtime: out of memory: cannot allocate 1413480448-byte block (737902592 in use)
fatal error: out of memory
runtime stack:
runtime.throw(0x156b255, 0xd)
C:/go/src/runtime/panic.go:774 +0x64
runtime.largeAlloc(0x54400000, 0x1f20101, 0x37b6f0b0)
C:/go/src/runtime/malloc.go:1140 +0x108
runtime.mallocgc.func1()
C:/go/src/runtime/malloc.go:1033 +0x39
runtime.systemstack(0x56e22b0)
C:/go/src/runtime/asm_386.s:399 +0x53
runtime.mstart()
C:/go/src/runtime/proc.go:1146
官方解释
https://github.com/ethereum/go-ethereum/issues/14633
You will not be able to mine on a 32bit OS (or running a 32bit version of Geth). The ethash mining DAG requires more memory than the 32bit address space allows. Please use a 64bit machine, 64bit OS and 64bit verision of Geth if you wish to mine.
解决办法
解决办法1(推荐):换成64位的geth就可以了
解决办法2:降低geth的缓存大小
查看geth是32位还是64位
shell> geth version
执行结果:
Geth
Version: 1.9.7-stable
Git Commit: a718daa674a2e23cb0c8a6789f7e5467e705bbbd
Git Commit Date: 20191107
Architecture: amd64
Protocol Versions: [64 63]
Network Id: 1
Go Version: go1.13.4
Operating System: windows
GOPATH=
GOROOT=C:\go
Architecture: amd64表示是64位的应用程序。
windows中查看exe程序是32位还是64位
参考:https://www.cnblogs.com/chrischennx/p/6132435.html