Game: on 16 GB of RAM the game's memory outgrows RAM within a minute of loading a save, then swap fills on area changes until RAM is at 0 #388
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/upscaling
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot#388
Loading…
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?
Longshot version
v3.0.0-rc.3 (source 51559a15)
Channel
Release candidate
What kind of problem
Performance / memory
What happened
On a 16 GB PC the game's memory is larger than the RAM from the first minute of play, and every area change pushes more
of it into swap. In an 11-minute session available RAM reached 0 and swap was 15 of the 15.4 GB zram device when I
quit, outside Kakariko. I expected a 9.8 GB guest window to fit on a 16 GB PC with room for the desktop. The game didn't
crash (I closed it), but it was close to running out of memory.
I sampled the game process (
/proc/<pid>/statusandsmaps_rollup),/proc/meminfo, zram andnvidia-smievery 5 swhile playing normally. The game's memory = resident + swapped (MB):
What it shows:
the save loads. During the load the game's private memory reaches 8.3 GB (
RssAnon) on top of the guest window,then most of it goes to swap or is freed (0.8 GB by 9:00).
of the swapped part). The log's
vk: memory: working set ... (peak 12155)agrees.and swap went from 9.9 to 15.1 GB. The log's
vk: imports:line went from 87 live (1480 MB) to 106 live (1912 MB)over the same stretch. In four longer sessions on 2026-11-13 (same build) imports only grew, from 36 MB up to
2.3–4.8 GB (360 live) by the end of each session.
The other programs used little: the largest was under 400 MB the whole time (desktop compositor, terminal).
whose swap is on disk the same footprint would likely stutter much more.
Steps: load a save on a 16 GB PC, play for ten minutes with two or three area changes, and watch swap
(
free -m,swapon --show).Where in the game
Child Link: Zora's River → Zora's Domain → back out → Hyrule Field → outside Kakariko. Normal play.
How often
Every session: the four logs from 2026-11-13 show the same pattern (working set peaking at 10.5–13.5 GB, then the game's
own memory being swapped out while imports grow).
Graphics card and driver version
NVIDIA GeForce RTX 3070 Ti 8 GB, driver 595.104.02
CPU, RAM and operating system
Intel Core i7-12700K, 16 GB RAM (15,757 MB usable), swap 15.4 GB zram + 4 GB partition; Pop!_OS 24.04 (COSMIC),
kernel 7.2.15
Changes from the defaults
Quality preset Custom, from Auto (this PC), which picks tier 3 here; the memory budgets are still the Balanced (8GB) preset's
(
memory_budget=3, VRAM budget row 4.8 GB). NVIDIA DLSS on, rendering 1920x1080 to a 2560x1440 output (the log:NVIDIA DLSS: ... 1920x1080 ... -> 2560x1440, mode 2, preset K). Frame rate cap off, frame generation off, windowed.No
longshot_env.txt, no overlays or injectors.Related
Possibly related to the v2.1.0 "RAM and VRAM fill up over play time" report,
https://github.com/NotRexed/Hookshot/issues/993, but this build doesn't crash and the growth is mostly the shared guest
window and imports.
Before you send it
longshot_log.txtfor this session follows in a comment.Claimed: I'm working on this on the PC it was reported from (RTX 3070 Ti 8 GB, 16 GB RAM, zram, Pop!_OS 24.04).
Score (docs/workflow.md): severity S0 (8), since past 0 MB available the next step is the out-of-memory killer or a
frozen desktop; reach about 0.4 (16 GB is the most common RAM size; Windows meets the same footprint at its commit
limit, #333); confidence 0.4 for now (one report with a log),
1.0 once reproduced on
main. About 1.3.Plan: reproduce on current
mainwith a scripted route across area changes and the same 5 s sampler, then work outwhat holds each part (the load's anonymous peak, the guest window's resident pages, the imports that are never given
back) and change one thing at a time, measured.
Overlapping work I'll build on rather than redo:
precompile, which is most of the anonymous peak on the Deck)
Reproduced on current
main(0caf0618) on the reporting PC (RTX 3070 Ti 8 GB, driver 595.104.02, i7-12700K, 16 GB RAM, zram,Pop!_OS 24.04), and taken apart. Confidence is now 1.0 (reproduced with logs), so the score is about 3.2.
How it was measured. A scripted tour through the control bridge: the save at Zora's River loaded, then the debug teleport
through Zora's Domain, Hyrule Field, Kakariko, the Market, Kokiri Forest, Lake Hylia, Death Mountain Trail and Goron City, 40 s
in each with a walk and camera turns (about 7 minutes). The game's memory was sampled every 2 s from
/proc/<pid>/statusandsmaps_rollup(resident + swapped, as in the report), with/proc/meminfobeside it. The runs were windowless, at thereporter's settings (
memory_budget=3, 2560x1440 output). These are memory observations, and fps is reported as anobservation only.
What main already fixed.
a4c77174(#324, after rc.3) tells the gamehow many pages it has mapped. On main its mapped pages stop at about 2.8 GB, against the 7.9-8.4 GB of the rc.3 sessions. The
guest window (the game's own memory, resident + swapped) peaked at 7.0-8.1 GB in every run here (7.4-7.6 GB in most), against 9+ GB in the report.
What is left, by part (one tour each, game total = private + guest window, resident + swapped):
longshot_load_start.txt: "In one session508 listed pipelines were in no cache when their programs were loaded" (500 is the limit). From then on every start keeps
the shader modules of about 19,400 programs: 8.5 GB of private memory, which the kernel pushes to swap at once. That is
the 8.3 GB
RssAnonof the report. #223 lets those modules go onLinux PCs of 20 GB or less. A cold NVIDIA cache gave 1,903 such misses in one run here and set the marker as well.
eight areas. The close's census says what it is: 7,391 programs loaded (1.39 GB of their code read into the driver's
modules, which are never let go) and 10,686 graphics pipelines built for them, of which draws took 3,859. Another 1.2 GB
is the pipeline cache's file, read whole at the start and kept by the driver.
frees them: 11.6 GB was zeroed over one tour. I wrote and measured a change that gives back the parts no import holds. It
moved nothing, because the game mapped 11.9 of those 12.7 GB again at once (it recycles the same pools). That is a measured
dead end, not a leak.
RX_VK_IMPORT_CAP_MB=2000halved them (1.0 GB), but the game's total didn't move: the pages are the game's and only becomeswappable.
Hill-climbing (one change at a time from main's behaviour, accepted only if the game's total went down beyond run-to-run
noise without an fps or hitch cost; rounds 1-2 on one build with switches, where
HOS_FREED_*turned the host change on and off):RX_VK_PCACHE_LOAD=0RX_VK_IMPORT_CAP_MB=2000MALLOC_ARENA_MAX=2RX_VK_MALLOC_TRIM_MB=16RX_VK_PCACHE_LOAD=0, programs loaded before the titleThe kept step is #416. On a Linux PC with NVIDIA's driver and 20 GB of RAM or
less, with programs loaded at create, it leaves the pipeline cache file unread, and NVIDIA's own disk cache answers instead.
Against main, three interleaved runs each: the game's peak was 831 MB lower (11.9 against 12.7 GB, medians) and the lowest
MemAvailable 329 MB higher, with 1.3 GB less swap in use and the same fps. What it costs: a load at create takes 5.0 against
1.8 ms on the load workers, and draws waited for a load 10 times against 2 per tour (206 against 52 ms). More load workers
didn't win that back. It also stops
RX_VK_PCACHE_LOAD=0from writing a small cache over the 1.2 GB file once 16 play fileshave piled up. Test request T-XTVW asks for a longer session on another 16 GB Linux NVIDIA PC.
What it does not fix, and the follow-ups I'd suggest (not claimed):
precompile). The marker's switch to start mode is a 5 GB step for good on a 16 GB PC. It could take that into account, or
ask for a new preparation instead (the marker's text already suggests one).
go once a program's noted pipelines are built, as #223 does after the
precompile. Or graphics pipelines could be made from module identifiers, as compute ones already are
(
module_ids.h), with the code read only for a variant that must be compiled.Measured by an AI agent (Claude Code) on the reporter's PC.