Skip to content

Rework memory pressure system#261

Open
kwsantiago wants to merge 5 commits into
bitcoinknots:29.x-knotsfrom
privkeyio:216-rework-memory-pressure-system
Open

Rework memory pressure system#261
kwsantiago wants to merge 5 commits into
bitcoinknots:29.x-knotsfrom
privkeyio:216-rework-memory-pressure-system

Conversation

@kwsantiago

Copy link
Copy Markdown

Closes #216

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Reworks the node’s memory-pressure handling to trigger cache flushes more reliably (including during idle periods) and to reserve flush headroom for LevelDB allocations, addressing edge cases described in #216.

Changes:

  • Reserve a fixed “flush headroom” in coins cache sizing to avoid running out of allocatable space during LevelDB batch writes.
  • Add a cross-platform GetAvailableSystemMemory() helper and update SystemNeedsMemoryReleased() to use it.
  • Change -lowmem defaults (200 MiB on Linux/Windows) and add a periodic idle scheduler task to flush caches when memory pressure is detected.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/validation.cpp Reserves LevelDB flush headroom in cache sizing; integrates memory-pressure signal into flush decision and cache-emptying behavior.
src/util/mempressure.h Exposes new available-memory query helper.
src/util/mempressure.cpp Implements GetAvailableSystemMemory() and updates memory-pressure detection logic.
src/init.cpp Updates -lowmem defaults/validation and adds periodic idle memory-pressure flushing via scheduler.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/init.cpp
Comment thread src/init.cpp
Comment thread src/init.cpp
Comment thread src/validation.cpp
Comment thread src/validation.cpp Outdated
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.

Rework memory pressure system

5 participants