diff --git a/Makefile.cbm b/Makefile.cbm index ddd4ba9bc..666a94551 100644 --- a/Makefile.cbm +++ b/Makefile.cbm @@ -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) diff --git a/src/mcp/mcp.c b/src/mcp/mcp.c index 60a8d120c..3924b8683 100644 --- a/src/mcp/mcp.c +++ b/src/mcp/mcp.c @@ -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);