mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-08 08:53:43 +08:00
Release RAM after indexing, static-link Windows binary
- Call cbm_mem_collect() (mi_collect(true)) after pipeline_free in both index_repository and auto-index, returning mimalloc pages to OS - Add -static to Windows linker flags so the binary is standalone (no libc++.dll / libunwind.dll dependency)
This commit is contained in:
+1
-1
@@ -78,7 +78,7 @@ CXXFLAGS_TSAN = $(CXXFLAGS_COMMON) -g -O1 \
|
||||
IS_MINGW := $(shell echo | $(CC) -dM -E - 2>/dev/null | grep -q 'define _WIN32 ' && echo yes || echo no)
|
||||
WIN32_LIBS :=
|
||||
ifeq ($(IS_MINGW),yes)
|
||||
WIN32_LIBS := -lws2_32 -lpsapi -Wl,--allow-multiple-definition -Wl,--stack,8388608
|
||||
WIN32_LIBS := -lws2_32 -lpsapi -Wl,--allow-multiple-definition -Wl,--stack,8388608 -static
|
||||
endif
|
||||
|
||||
LDFLAGS = -lm -lstdc++ -lpthread -lz $(LIBGIT2_LIBS) $(WIN32_LIBS)
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "pipeline/pipeline.h"
|
||||
#include "cli/cli.h"
|
||||
#include "watcher/watcher.h"
|
||||
#include "foundation/mem.h"
|
||||
#include "foundation/platform.h"
|
||||
#include "foundation/compat.h"
|
||||
#include "foundation/compat_fs.h"
|
||||
@@ -1230,6 +1231,7 @@ static char *handle_index_repository(cbm_mcp_server_t *srv, const char *args) {
|
||||
* No need to close srv->store — pipeline doesn't touch the open store. */
|
||||
int rc = cbm_pipeline_run(p);
|
||||
cbm_pipeline_free(p);
|
||||
cbm_mem_collect(); /* return mimalloc pages to OS after large indexing */
|
||||
|
||||
/* Invalidate cached store so next query reopens the fresh database */
|
||||
if (srv->owns_store && srv->store) {
|
||||
@@ -2128,6 +2130,7 @@ static void *autoindex_thread(void *arg) {
|
||||
|
||||
int rc = cbm_pipeline_run(p);
|
||||
cbm_pipeline_free(p);
|
||||
cbm_mem_collect(); /* return mimalloc pages to OS after indexing */
|
||||
|
||||
if (rc == 0) {
|
||||
cbm_log_info("autoindex.done", "project", srv->session_project);
|
||||
|
||||
Reference in New Issue
Block a user