diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-24 13:09:24 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:14 -0300 |
| commit | a4f5e5b8fc5aed894f13ffe2b96cbd9c5a11770d (patch) | |
| tree | 9b0a3dc1e15cce2d62adc8d2aa24d3b4fd68a60c /src/main.zig | |
| parent | b4fc9fed0c2d10cd8c1b3b99246b39c262ac5ade (diff) | |
| download | pardes-a4f5e5b8fc5aed894f13ffe2b96cbd9c5a11770d.tar.gz pardes-a4f5e5b8fc5aed894f13ffe2b96cbd9c5a11770d.zip | |
Allocate SDL's memory from the gui's Zig allocator, and give it all back on the way out
SDL allocated with libc malloc. runNative now installs the shared C heap over
the gui's gpa with SDL_SetMemoryFunctions before SDL's first call: SDL frees
with whichever functions are current, so none of its memory may predate
them. SDL allocates from its own threads too, and the gpa is thread-safe in
every build (a DebugAllocator in Debug, libc's malloc in release).
That put SDL in a Debug build's leak report, and the report filled up: 1769
blocks at exit, because runNative never released its GPU objects, its window
or SDL itself. The process was about to exit, but a report that long hides
any leak that matters. runNative now releases every pipeline, texture,
sampler and buffer the Gui holds, closes the gamepad, destroys the GPU device
and the window, and calls SDL_Quit, all through defers. Eight 32-byte blocks
are left, and they are SDL's: 3.4.4's VULKAN_INTERNAL_DestroyCommandPool
never frees two arrays per command buffer (buffersUsedInPendingTransfers and
texturesUsedInPendingTransfers), which SDL's main branch now frees. They go
away with the next SDL; a comment at the SDL_Quit says so.
The frame-cost harness and a software-present run (PARDES_SOFT_PRESENT) both
run and exit cleanly in Debug.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Diffstat (limited to 'src/main.zig')
0 files changed, 0 insertions, 0 deletions
