Skip to content

Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦

C

fix(build): guard malloc_trim to glibc for musl libc compatibility

iiEliJasdd7ff1964759
diff --git a/c/colibri.c b/c/colibri.c
index 8120db29..21f92a40 100644
--- a/c/colibri.c
+++ b/c/colibri.c
@@ -40,6 +40,8 @@
#include <sys/mman.h> /* mlock: inchioda le pagine in RAM / wire pages into RAM */
#ifdef __linux__
#include <sys/syscall.h> /* COLI_NUMA: mbind degli slab expert / expert-slab interleave */
+#endif
+#ifdef __GLIBC__
#include <malloc.h> /* Needed to actually free memory if we go over our RAM budget */
#endif
#include <sys/stat.h> /* fstat per mmap degli shard (COLI_MMAP) */
@@ -8453,7 +8455,7 @@ static void rss_guard(Model *m){
if(dropped)
fprintf(stderr,"[RAM-GUARD] RSS %.1f GB over the %.1f GB budget (#403): "
"dropped %d cached experts, cap -> %d\n", rss, lim, dropped, m->ecap);
-#ifdef __linux__
+#ifdef __GLIBC__
malloc_trim(1024);
#endif
}