Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
refactor(git,store): allocate freshness data through the memory core
Martin Vogel3a1b5a128514
diff --git a/src/git/git_context.c b/src/git/git_context.cindex bd4f9c423..05ec5f2c8 100644--- a/src/git/git_context.c+++ b/src/git/git_context.c@@ -3,6 +3,7 @@#include "foundation/compat_fs.h"#include "foundation/constants.h"#include "foundation/log.h"+#include "foundation/mem_core.h"#include "foundation/platform.h"#include "foundation/str_util.h"@@ -524,16 +525,17 @@ static void status_add_sample(int *total, char ***samples, int *sample_count,*truncated = true;return;}- char *copy = (char *)malloc(path_len + 1);+ char *copy = (char *)cbm_alloc(CBM_MEM_CLASS_OTHER, path_len + 1);if (!copy) {*truncated = true;return;}memcpy(copy, path, path_len);copy[path_len] = '\0';- char **grown = (char **)realloc(*samples, (size_t)(*sample_count + 1) * sizeof(char *));+ char **grown = (char **)cbm_realloc(CBM_MEM_CLASS_OTHER, *samples,+ (size_t)(*sample_count + 1) * sizeof(char *));if (!grown) {- free(copy);+ cbm_free(CBM_MEM_CLASS_OTHER, copy);*truncated = true;return;}@@ -668,12 +670,12 @@ void cbm_git_worktree_status_free(cbm_worktree_status_t *st) {return;}for (int i = 0; i < st->tracked_sample_count; i++) {- free(st->tracked_paths[i]);+ cbm_free(CBM_MEM_CLASS_OTHER, st->tracked_paths[i]);}- free(st->tracked_paths);+ cbm_free(CBM_MEM_CLASS_OTHER, st->tracked_paths);for (int i = 0; i < st->untracked_sample_count; i++) {- free(st->untracked_paths[i]);+ cbm_free(CBM_MEM_CLASS_OTHER, st->untracked_paths[i]);}- free(st->untracked_paths);+ cbm_free(CBM_MEM_CLASS_OTHER, st->untracked_paths);memset(st, 0, sizeof(*st));}diff --git a/src/store/store.c b/src/store/store.cindex 2471d00d7..41fcbc4fb 100644--- a/src/store/store.c+++ b/src/store/store.c@@ -5072,7 +5072,7 @@ void cbm_store_coverage_meta_clear(cbm_coverage_meta_t *meta) {free((char *)meta->index_mode);free((char *)meta->recorded_at);free((char *)meta->recording_status);- free((char *)meta->indexed_checkout_sha);+ cbm_free(CBM_MEM_CLASS_STORE, (char *)meta->indexed_checkout_sha);memset(meta, 0, sizeof(*meta));}@@ -5117,7 +5117,8 @@ int cbm_store_coverage_meta_get(cbm_store_t *s, const char *project, cbm_coveragout->hash_records_complete = sqlite3_column_int(stmt, 8) != 0;if (has_checkout_column) {const char *sha = (const char *)sqlite3_column_text(stmt, 9);- out->indexed_checkout_sha = sha && sha[0] ? heap_strdup(sha) : NULL;+ out->indexed_checkout_sha =+ sha && sha[0] ? cbm_mem_strdup(CBM_MEM_CLASS_STORE, sha) : NULL;}sqlite3_finalize(stmt);if (!out->project || !out->generation || !out->index_mode || !out->recorded_at ||