mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 09:09:56 -04:00
Break the memory report down past VMA, by owner in system memory, and by growth over a session.
Every report adds a line for video memory outside VMA (the driver's usage and budget per heap against VMA's blocks, and counts of pipelines by kind and by last use, stage libraries, compute pipelines, layouts and descriptor pools, with the swapchain, DLSS and FSR sizes), a line that splits the process's commit by owner (the game's heap and maps, device-local memory, VMA's host blocks, the C runtime heap with the shader caches, pipeline tables, texture cache, log queue and flight recorder in it, the driver's pipeline cache data and the rest), and a line naming what grew by more than 64 MiB since the report before and since play began. Every ten minutes of play and at exit a ranking line orders the categories by growth and marks those that only climbed; tests/mem_growth_check.py checks that bookkeeping. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
// SRW locks and condition variables.
|
||||
#include <io.h>
|
||||
#include <limits.h>
|
||||
#include <malloc.h> // _get_heap_handle (plat_heap_info)
|
||||
#include <stdio.h>
|
||||
#include <winsock2.h> // before windows.h, which would otherwise pull in the old winsock.h
|
||||
#include <ws2tcpip.h>
|
||||
@@ -2067,6 +2068,18 @@ void plat_process_memory(uint64_t *resident, uint64_t *private_bytes) {
|
||||
*resident = pm.WorkingSetSize, *private_bytes = pm.PrivateUsage;
|
||||
}
|
||||
|
||||
// The UCRT's malloc takes its memory from the heap _get_heap_handle names (the process heap); HeapSummary sums it. The
|
||||
// other heaps are only counted: one made with HEAP_NO_SERIALIZE has no lock to take.
|
||||
void plat_heap_info(PlatHeapInfo *h) {
|
||||
memset(h, 0, sizeof *h);
|
||||
HANDLE crt = (HANDLE)_get_heap_handle();
|
||||
HEAP_SUMMARY s = {.cb = sizeof s};
|
||||
if (crt && HeapSummary(crt, 0, &s)) h->committed = s.cbCommitted, h->used = s.cbAllocated;
|
||||
HANDLE hs[256];
|
||||
DWORD n = GetProcessHeaps(256, hs);
|
||||
for (DWORD i = 0; i < n && i < 256; i++) h->other_heaps += hs[i] != crt;
|
||||
}
|
||||
|
||||
// ---- child processes
|
||||
|
||||
struct PlatChild {
|
||||
|
||||
Reference in New Issue
Block a user