mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2503] [CLOSED] macOS: read available memory for the conversation memory guard #4082
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#4082
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/2503
Author: @joesinvestments
Created: 10/14/2026
Status: ❌ Closed
Base:
main← Head:macos-memory-guard📝 Commits (1)
6f4854amacOS: read available memory for the conversation memory guard📊 Changes
1 file changed (+16 additions, -0 deletions)
View changed files
📝
src/core/conversation_memory.cpp(+16 -0)📄 Description
Title
Issue: part of #2502 (cause 1 of 2; the Metal snapshot check is the other and is not touched here)
Summary
On every Mac the engine logs
memory guard: the available RAM cannot be read; parking and session save/restore are refused, becausesample_host_memory()has readings for_WIN32and__linux__only. This adds a macOS reading:free + inactive + purgeable pages, the rule
src/core/expert_source.cppalready uses for macOS, andhw.memsizeforthe total.
What changed
src/core/conversation_memory.cpponly (+16 lines): an#elif defined(__APPLE__)include of<mach/mach.h>and<sys/sysctl.h>, and an#elif defined(__APPLE__)branch insample_host_memory()that feedscombine()as theother platforms do. The source label stays
meminfo, to keep the change small.How it was checked
main296b59d2). The start-up line changes fromthe available RAM cannot be read; parking and session save/restore are refusedtomemory guard: limit 64.0 GiB (source: meminfo), current 5.1 GiB, reclaimable cache credited 0.0 GiB; available 58.9 GiB (MemAvailable 58.9 GiB), floor 2560 MiB.UD-Q4_K_XL (both streaming from the SSD), same speed (UD-Q4_K_XL 56.7 / 51.9 / 52.5 tok/s before and after).
__APPLE__undefined the file reduces to exactly thecurrent source:
unifdef -U__APPLE__ -D__linux__ -U_WIN32gives the same 284 lines before and after, andunifdef -U__APPLE__ -D_WIN32 -U__linux__the same 292 lines.Extra Notes
With this change and
--conversation-cache-mib 4096 --conversation-cache-slots 4, parking on Metal is attempted butthen refused by the snapshot check (
invalid checkpoint running-state payload), described in #2502. So this PR alonedoes not make a side request keep the main conversation on a Mac; it removes the first of the two blocks.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.