Repository navigation
feat: add Standby List Cleaner tab (ISLC-style memory purge) - #1089
Merged
Merged
Conversation
Implements Standby List Cleaner (replaces its WIP placeholder in Gaming & Profiles). Closes #325. - StandbyMemoryService: GlobalMemoryStatusEx for live stats (no admin) and ntdll NtSetSystemInformation(SystemMemoryListInformation=80, MemoryPurgeStandbyList=4) to purge — the same mechanism RAMMap/ISLC use. Enables SeProfileSingleProcessPrivilege via AdjustTokenPrivileges first and checks ERROR_NOT_ALL_ASSIGNED (the silent "not admin" trap, since AdjustTokenPrivileges returns true even when the privilege isn't held). All-[LibraryImport]; LookupPrivilegeValueW pinned to the W entry point. - Purge is non-destructive: standby is clean disk-backed file cache, so clearing it loses nothing (Windows reloads from disk on next use). - StandbyMemoryViewModel: 2s live poll, manual purge, and threshold-based auto-purge (pure ShouldAutoPurge, unit-tested). Reading works without admin; purge is gated on AdminHelper.IsElevated() with the standard banner. - Marked PREVIEW via the badge mechanism.
| try | ||
| { | ||
| Marshal.WriteInt32(buffer, NativeMethods.MemoryPurgeStandbyList); | ||
| int status = NativeMethods.NtSetSystemInformation(NativeMethods.SystemMemoryListInformation, buffer, sizeof(int)); |
|
|
||
| private static void EnableProfilePrivilege() | ||
| { | ||
| if (!NativeMethods.OpenProcessToken(NativeMethods.GetCurrentProcess(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Implements Standby List Cleaner (Gaming & Profiles), replacing its WIP placeholder. Closes #325.
The built-in equivalent of ISLC — frees cached "standby" memory to reduce stutter when RAM runs low in games.
How
StandbyMemoryService:GlobalMemoryStatusEx(total / available / load%) — no admin, so the display is always live.NtSetSystemInformation(SystemMemoryListInformation=80, MemoryPurgeStandbyList=4)— the RAMMap/ISLC mechanism.SeProfileSingleProcessPrivilegeenabled on an elevated token. The service enables it viaAdjustTokenPrivilegesand then checksGetLastError == ERROR_NOT_ALL_ASSIGNED— becauseAdjustTokenPrivilegesreturnstrueeven when the privilege isn't held (a non-elevated token), so a naive check would silently no-op. Without this, the purge appears to "do nothing".[LibraryImport];LookupPrivilegeValueWpinned to the W entry point (A/W rule).StandbyMemoryViewModel— 2s live poll, manual Purge, and an auto-purge toggle + threshold slider (pureShouldAutoPurge, unit-tested). Purge is gated onAdminHelper.IsElevated()with the standard elevation banner; reading stats works without admin.Preview
Marked PREVIEW (sidebar pill + banner).
Tests
StandbyMemoryTests—ShouldAutoPurge(below/at/above threshold + zero/negative guards),MemoryStatusformatting + MB computation, Empty.NavLeaf_StandbyCleaner_IsImplementedAndMarkedPreview.Verification