mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-16 13:59: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:
@@ -6,6 +6,7 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <malloc.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/futex.h>
|
||||
#include <linux/userfaultfd.h>
|
||||
@@ -2241,6 +2242,17 @@ void plat_process_memory(uint64_t *resident, uint64_t *private_bytes) {
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
// glibc's mallinfo2 (2.33 and later) sums every arena: arena is what the arenas took with brk and mmap, hblkhd the
|
||||
// blocks mmapped one by one, uordblks what the arenas handed out. Other C libraries leave the figures unknown.
|
||||
void plat_heap_info(PlatHeapInfo *h) {
|
||||
memset(h, 0, sizeof *h);
|
||||
#if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 33))
|
||||
struct mallinfo2 m = mallinfo2();
|
||||
h->committed = (uint64_t)m.arena + m.hblkhd;
|
||||
h->used = (uint64_t)m.uordblks + m.hblkhd;
|
||||
#endif
|
||||
}
|
||||
|
||||
// ---- memory limits
|
||||
//
|
||||
// Linux overcommits, so memory that runs short does not fail an allocation: the OOM killer ends the process, when it
|
||||
|
||||
Reference in New Issue
Block a user