Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/foundation/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "foundation/constants.h"

#define MAX_RAM_FRACTION 1.0
#define DEFAULT_RAM_FRACTION 0.5
#define DEFAULT_RAM_FRACTION 0.25
#include <mimalloc.h>
#include <stdatomic.h>
#include <stdio.h>
Expand Down Expand Up @@ -122,6 +122,10 @@ void cbm_mem_init(double ram_fraction) {
mi_option_set(mi_option_arena_eager_commit, 0);
mi_option_set(mi_option_purge_decommits, SKIP_ONE);
mi_option_set(mi_option_purge_delay, 0); /* immediate purge, no 1s delay */
/* Purge arenas aggressively (default multiplier is 10x purge_delay). */
mi_option_set(mi_option_arena_purge_mult, 1);
/* Reclaim pages from exited worker thread heaps on free. */
mi_option_set(mi_option_page_reclaim_on_free, 1);

/* CBM_MEM_BUDGET_MB env override (memory analogue of CBM_WORKERS).
* Lets users cap the budget directly without an enclosing cgroup —
Expand Down
3 changes: 2 additions & 1 deletion src/foundation/system_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,8 @@ int cbm_default_worker_count(bool initial) {
cbm_system_info_t info = cbm_system_info();
if (initial) {
/* Use all cores for initial indexing — user is waiting */
return info.total_cores;
int cap = info.total_cores > 8 ? 8 : info.total_cores;
return cap;
}
/* Incremental: leave headroom for user's apps */
int workers = info.perf_cores - SKIP_ONE;
Expand Down
Loading