mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1394] [CLOSED] serve: evict parked conversations to pass the physical-RAM gate instead of dropping the snapshot #3426
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#3426
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/1394
Author: @Arthur031221
Created: 10/7/2026
Status: ❌ Closed
Base:
main← Head:conversation-cache-evict-for-ram-gate📝 Commits (1)
e6dd58fserve: a full conversation cache evicts to pass the physical-RAM gate instead of dropping the snapshot📊 Changes
6 files changed (+229 additions, -9 deletions)
View changed files
📝
include/strata/core/conversation_cache.hpp(+51 -7)📝
include/strata/core/conversation_memory.hpp(+4 -0)📝
src/core/conversation_cache_test.cpp(+124 -0)📝
src/core/conversation_memory.cpp(+10 -0)📝
src/core/conversation_memory_test.cpp(+29 -0)📝
src/program/generate.cpp(+11 -2)📄 Description
Title
Issue: Resolves #1347
Summary
With a full conversation cache and little free host RAM, a long conversation wasn't parked even when the parked ones held more RAM than the snapshot needed. The next request had to read its whole prompt again (270k tokens, 96 s, 32 times in the reporter's log).
What changed
When the plain RAM check refuses, it now calls
malloc_trim(0)to give freed heap back (glibc keeps freed segments in its heap) and reads free RAM again. If that's still not enough, it evicts the oldest parked conversations one at a time, reading again after each, until the snapshot fits. Pinned prefixes stay, as inmake_room(). Nothing is evicted if the host reports no figure or the parked ones can't cover it.Extra Notes
Builds on the code @alanthinker posted in #1347 (
github.com/alanthinker/Strata@c62b540). Tested with new cases inconversation_cache_testandconversation_memory_test(-DSTRATA_BUILD_CONVERSATION_TESTS=ON).I used Claude/Codex to assist with preparing, checking and double-checking this change.
Co-authored-by: Alanthinker Xiang 11045022+alanthinker@users.noreply.github.com
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.