mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 08:19:56 -04:00
Give Linux a memory limit that the low-memory handling can read.
Linux overcommits, so plat_commit_enforced was 0 there and nothing the runtime does when memory runs short ever ran: no stale-texture drops, no idle or disuse eviction. plat_commit_info on Linux now reports the limit with the least headroom of the cgroup v2 limits the process lives under (memory.max, memory.high, against memory.current less its file cache), the machine's RAM (MemAvailable against MemTotal) and, with vm.overcommit_memory = 2, the commit limit; a read is reused for 250 ms and the first one is logged. The spare VRAM blocks stand down under low memory only where device memory counts against that limit (plat_commit_counts_vram: Windows, and any integrated GPU). Windows behaves as before. Pull request #378 by mooki000, taken as it is. The Windows files compile; the Linux code is not compiled or run here. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -1888,6 +1888,15 @@ void plat_commit_info(double *proc_mb, double *used_mb, double *limit_mb) {
|
||||
|
||||
int plat_commit_enforced(void) { return 1; }
|
||||
|
||||
// The numbers name the one limit there is, the system's commit.
|
||||
int plat_commit_note(char *out, size_t cap) {
|
||||
if (cap) out[0] = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// The driver charges the device memory it allocates to the system's commit.
|
||||
int plat_commit_counts_vram(void) { return 1; }
|
||||
|
||||
void plat_process_memory(uint64_t *resident, uint64_t *private_bytes) {
|
||||
PROCESS_MEMORY_COUNTERS_EX pm = {.cb = sizeof pm};
|
||||
*resident = *private_bytes = 0;
|
||||
|
||||
Reference in New Issue
Block a user