start bor v2.7.3 memory continues to grow until it runs out
My ec2 96G memory, after start bor, About 5 minutes , memory will run out. i try to modify some value, but no help.
maxpendpeers change 500 to 50
globalslots change 131072 to 4096
globalqueue change 131072 to 1024
maxpeers change 2000 to 50
snapshot set to false
can you help or give some suggestions? thanks.
It would help if we have a pprof when the memory consumption is increasing.
bor debug pprof -address 127.0.0.1:3131 -seconds 60 -output pprof
thanks for your reply, upgrade to v2.8.0 and try to see the memory usage.
I’m experiencing a similar memory issue.
Summary
The 16.47 GB resident heap is dominated by two structural costs in pathdb's flush path:
- 47% — single-shot pebble batch allocation. (*buffer).flush.func1 calls db.NewBatchWithSize((flushNodes.dbsize() + flushStates.dbsize()) * 11/10). For Polygon-style workloads, the dbsize estimator inflates a ~2 GB in-memory buffer into a ~7.6 GB contiguous rawalloc. Pebble then materializes another ~1.2 GB flushable batch when the write commits.
- 19% — copy-on-write storage map clones. (*stateSet).merge invokes writableStorage for every account whose storage submap is shared with a frozen-but-not-yet-flushed buffer. Each call allocates a fresh map[Hash][]byte and copies all entries, regardless of how many slots actually changed.
AI suggests me try to lower cache.gc. I changed config "cache" from 10240 (10GiB) to 5120 (5GiB)
enable debug log and restart bor, Persisted buffer content logs shows:
t=2026-05-18T12:46:34.834570+0000 lvl=debug msg="Persisted buffer content" nodes=315022 accounts=229530 slots=3642724 bytes="367.44 MiB" elapsed=4.237s t=2026-05-18T12:46:50.808426+0000 lvl=debug msg="Persisted buffer content" nodes=314479 accounts=231574 slots=3683816 bytes="370.59 MiB" elapsed=4.145s t=2026-05-18T12:49:27.908318+0000 lvl=debug msg="Persisted buffer content" nodes=315273 accounts=233477 slots=3724569 bytes="373.46 MiB" elapsed=3.917s t=2026-05-18T12:52:54.343616+0000 lvl=debug msg="Persisted buffer content" nodes=316978 accounts=235814 slots=3766767 bytes="376.93 MiB" elapsed=3.750s t=2026-05-18T13:04:02.491374+0000 lvl=debug msg="Persisted buffer content" nodes=837299 accounts=243613 slots=3905611 bytes="540.63 MiB" elapsed=5.382s t=2026-05-18T13:14:44.961184+0000 lvl=debug msg="Persisted buffer content" nodes=835690 accounts=251181 slots=4042626 bytes="550.44 MiB" elapsed=5.416s
@sunjiahui - For now, we recommend gc.cache=0 on mainnet.
@pratikspatil024 I think you mean --cache.gc=0, is simlr to this section in config.content
[cache]
gc = 0
@loglapa - yes. It is the same. One is CLI other one is config file
This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.
This issue was closed because it has been stalled for 28 days with no activity.