MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / mem_allocator_stats_line

Function mem_allocator_stats_line

src/foundation/mem.c:931–949  ·  view source on GitHub ↗

One line of mimalloc's stats table, logged as it comes. */

Source from the content-addressed store, hash-verified

929
930/* One line of mimalloc's stats table, logged as it comes. */
931static void mem_allocator_stats_line(const char *msg, void *arg) {
932 if (!msg || !msg[0]) {
933 return;
934 }
935 char line[512];
936 size_t n = 0;
937 for (const char *p = msg; *p && n + 1 < sizeof(line); p++) {
938 line[n++] = (*p == '\n' || *p == '\r' || *p == '\t') ? ' ' : *p;
939 }
940 line[n] = '\0';
941 /* trailing blanks make the log unreadable; trim */
942 while (n > 0 && line[n - 1] == ' ') {
943 line[--n] = '\0';
944 }
945 if (line[0] == '\0') {
946 return;
947 }
948 cbm_log_info("mem.allocator.stats", "tag", (const char *)arg, "line", line);
949}
950
951void cbm_mem_allocator_stats_log(const char *tag) {
952 char enabled[CBM_SZ_16];

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected