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

Function wd_stack_max

internal/cbm/extract_defs.c:5654–5663  ·  view source on GitHub ↗

Generous safety ceiling (frames), env-overridable via CBM_WALK_DEFS_MAX. Realistic files never approach this; it only bounds a pathological/adversarial file so extraction degrades to a warned skip rather than unbounded memory.

Source from the content-addressed store, hash-verified

5652// Realistic files never approach this; it only bounds a pathological/adversarial
5653// file so extraction degrades to a warned skip rather than unbounded memory.
5654static int wd_stack_max(void) {
5655 const char *e = getenv("CBM_WALK_DEFS_MAX");
5656 if (e) {
5657 int v = atoi(e);
5658 if (v > 0) {
5659 return v;
5660 }
5661 }
5662 return 8 * 1024 * 1024; // 8M frames (~320 MB) default
5663}
5664
5665static void wd_push(wd_stack_t *s, TSNode node, const char *enclosing_qn) {
5666 if (s->top >= s->cap) {

Callers 1

wd_pushFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected