Skip to content

init: auto-size dbcache to available system RAM#279

Open
kwsantiago wants to merge 2 commits intobitcoinknots:29.x-knotsfrom
privkeyio:feature-autosize-dbcache
Open

init: auto-size dbcache to available system RAM#279
kwsantiago wants to merge 2 commits intobitcoinknots:29.x-knotsfrom
privkeyio:feature-autosize-dbcache

Conversation

@kwsantiago
Copy link
Copy Markdown

Auto-size the default dbcache to half of system RAM (capped at 16 GiB) instead of the hardcoded 450 MiB default. Falls back to 450 MiB on platforms where RAM detection fails.

Also enables -lowmem by default with a 256 MiB threshold so caches are flushed before the system runs out of memory.

Platform support: Linux (sysinfo), Windows (GlobalMemoryStatusEx), macOS (sysctlbyname).

Closes #70

@luke-jr
Copy link
Copy Markdown
Collaborator

luke-jr commented Mar 16, 2026

How does this compare to bitcoin#34641 ?

@kwsantiago
Copy link
Copy Markdown
Author

kwsantiago commented Mar 16, 2026

@luke-jr Same idea, although this PR is more aggressive. This PR uses min(RAM/2, 16G) vs their clamp(100M, 0.25*(RAM-2G), 2G), paired with -lowmem on by default as a safety net.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Increase default dbcache to ∞

2 participants