Free the thread-local node-type cache to satisfy LeakSanitizer

cbm_kind_in_set builds a thread-local cache of calloc'd symbol bitsets (ks_cache) that was never freed, so LeakSanitizer (Linux x64) reported the per-worker-thread caches as leaks once the previously-empty grammars gained real node-type sets. Add cbm_kind_in_set_free_cache() and call it at worker-thread teardown (extract_worker, beside cbm_slab_destroy_thread) and main-thread exit (test runner, beside sqlite3_shutdown).
This commit is contained in:
Martin Vogel
2026-06-06 12:34:59 +02:00
parent 16034f21a8
commit d8d114747c
4 changed files with 28 additions and 1 deletions
+2
View File
@@ -48,6 +48,7 @@ enum { PP_CSHARP_M_PREFIX_LEN = 2 };
#include "pipeline/pipeline_internal.h"
#include "pipeline/pass_lsp_cross.h" /* cbm_pxc_* helpers for fused cross-file LSP */
#include "pipeline/lsp_resolve.h"
#include "helpers.h" /* cbm_kind_in_set_free_cache — per-worker-thread cache teardown */
#include "pipeline/worker_pool.h"
#include "foundation/compat.h"
#include "foundation/compat_thread.h"
@@ -635,6 +636,7 @@ static void extract_worker(int worker_id, void *ctx_ptr) {
/* Final cleanup (parser already destroyed in loop, just slab state) */
cbm_slab_destroy_thread();
cbm_kind_in_set_free_cache(); /* free this worker thread's node-type bitset cache */
}
static void merge_pkg_entries(cbm_pipeline_ctx_t *ctx, cbm_pkg_entries_t *pkg_entries,