{"record":{"id":"d1ef0359aeafe0c5","repo":"Tencent/matrix","slug":"unable-to-allocate-memory-for-a-new-acttab","errorCode":null,"errorMessage":"Unable to allocate memory for a new acttab.","messagePattern":"Unable to allocate memory for a new acttab\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"matrix/matrix-android/matrix-sqlite-lint/src/lemon/lemon-gen/lemon.c","lineNumber":441,"sourceCode":"\n/* The value for the N-th entry in yy_action */\n#define acttab_yyaction(X,N)  ((X)->aAction[N].action)\n\n/* The value for the N-th entry in yy_lookahead */\n#define acttab_yylookahead(X,N)  ((X)->aAction[N].lookahead)\n\n/* Free all memory associated with the given acttab */\nvoid acttab_free(acttab *p){\n  free( p->aAction );\n  free( p->aLookahead );\n  free( p );\n}\n\n/* Allocate a new acttab structure */\nacttab *acttab_alloc(void){\n  acttab *p = malloc( sizeof(*p) );\n  if( p==0 ){\n    fprintf(stderr,\"Unable to allocate memory for a new acttab.\");\n    exit(1);\n  }\n  memset(p, 0, sizeof(*p));\n  return p;\n}\n\n/* Add a new action to the current transaction set\n*/\nvoid acttab_action(acttab *p, int lookahead, int action){\n  if( p->nLookahead>=p->nLookaheadAlloc ){\n    p->nLookaheadAlloc += 25;\n    p->aLookahead = realloc( p->aLookahead,\n                             sizeof(p->aLookahead[0])*p->nLookaheadAlloc );\n    if( p->aLookahead==0 ){\n      fprintf(stderr,\"malloc failed\\n\");\n      exit(1);\n    }\n  }","sourceCodeStart":423,"sourceCodeEnd":459,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-sqlite-lint/src/lemon/lemon-gen/lemon.c#L423-L459","documentation":"In lemon.c (the parser generator shipped with matrix-sqlite-lint), acttab_alloc() mallocs the acttab structure used to build parser action tables. If malloc returns NULL, the tool prints this message and calls exit(1), aborting code generation. It is a fatal out-of-memory condition in the build-time generator, not a runtime SQLite-Lint error.","triggerScenarios":"Invoking the lemon generator so that ReportTable calls acttab_alloc() while the process cannot allocate sizeof(acttab) bytes; happens once at startup of table generation.","commonSituations":"Building matrix-sqlite-lint in a memory-starved CI runner or Docker container with a low memory cap; restricted virtual-memory ulimits; system-wide memory exhaustion during parallel native builds.","solutions":["Increase the build environment's memory (container quota or machine RAM) and re-run the build","Raise or remove the `ulimit -v` restriction in the build shell","Reduce parallelism of native builds (e.g. -j1) to lower peak memory pressure and retry","Retry the build — transient allocation failures typically resolve once memory is available"],"exampleFix":"// before\nninja -j32\n// after\nninja -j4  # reduce peak memory during native build","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure build containers have adequate memory for native codegen","Avoid over-parallelizing native builds on memory-limited hosts","Monitor CI host memory to catch exhaustion before builds fail"],"tags":["c","memory","parser-generator","build"],"backgroundTag":"out-of-memory","analyzedSha":"3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7","analyzedAt":"2026-09-08T08:01:39.722Z","contentChangedAt":"2026-09-08T08:01:39.722Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}