diff --git a/components/jk/OpenJKDF2 b/components/jk/OpenJKDF2 index 6a5d1d9..6a71507 160000 --- a/components/jk/OpenJKDF2 +++ b/components/jk/OpenJKDF2 @@ -1 +1 @@ -Subproject commit 6a5d1d968552c8a0409026480df601ae13b3fc90 +Subproject commit 6a715074f21b18e8c954e172f06b5934bd3b0b06 diff --git a/components/jk/include/jk_esp.h b/components/jk/include/jk_esp.h index 9b778b6..0957c1a 100644 --- a/components/jk/include/jk_esp.h +++ b/components/jk/include/jk_esp.h @@ -107,6 +107,13 @@ void jk_esp_alloc_release(void); ///< free the tracker table (engine shut down) int jk_esp_arrays_alloc(void); void jk_esp_arrays_free(void); size_t jk_esp_arrays_bytes(void); ///< size of the allocated block (0: none) +/// Buffers the engine makes once per process, freed once the engine and the +/// audio task have stopped (the next engine run makes new ones): the COG +/// lexer's input buffer (made by the first level load) and the mixer's chunk +/// buffer. Kept, they stayed in the middle of the PSRAM heap after the game +/// and split its largest free block. +void sithCogParse_ESP32_ReleaseLexer(void); +void stdSound_ESP32_Release(void); /// Log line void jk_esp_log(const char *fmt, ...); /// Set to 1 by the glue when the engine should quit at the next opportunity. diff --git a/components/jk/src/jk.cpp b/components/jk/src/jk.cpp index 3e4cdef..7d3e96c 100644 --- a/components/jk/src/jk.cpp +++ b/components/jk/src/jk.cpp @@ -1151,6 +1151,9 @@ void deinit() { g_audio_task.reset(); // the engine task and the mixer are gone: nothing uses the arrays now jk_esp_arrays_free(); + // and the buffers it made once per process (see jk_esp.h) + sithCogParse_ESP32_ReleaseLexer(); + stdSound_ESP32_Release(); #endif Tab5Emu::get().wait_frame(); // the presentation buffers belong to this engine run (~1.8 MB). Swapped