Tencent/matrix · critical

Unable to allocate memory for a new acttab.

Error message

Unable to allocate memory for a new acttab.

What it means

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.

Solutions

  1. Increase the build environment's memory (container quota or machine RAM) and re-run the build
  2. Raise or remove the `ulimit -v` restriction in the build shell
  3. Reduce parallelism of native builds (e.g. -j1) to lower peak memory pressure and retry
  4. Retry the build — transient allocation failures typically resolve once memory is available

Example fix

// before
ninja -j32
// after
ninja -j4  # reduce peak memory during native build
Defensive patterns

Strategy: retry

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08). Data as JSON: /api/errors/d1ef0359aeafe0c5. Report an issue: GitHub.

Appendix: source

Thrown at matrix/matrix-android/matrix-sqlite-lint/src/lemon/lemon-gen/lemon.c:441

/* The value for the N-th entry in yy_action */
#define acttab_yyaction(X,N)  ((X)->aAction[N].action)

/* The value for the N-th entry in yy_lookahead */
#define acttab_yylookahead(X,N)  ((X)->aAction[N].lookahead)

/* Free all memory associated with the given acttab */
void acttab_free(acttab *p){
  free( p->aAction );
  free( p->aLookahead );
  free( p );
}

/* Allocate a new acttab structure */
acttab *acttab_alloc(void){
  acttab *p = malloc( sizeof(*p) );
  if( p==0 ){
    fprintf(stderr,"Unable to allocate memory for a new acttab.");
    exit(1);
  }
  memset(p, 0, sizeof(*p));
  return p;
}

/* Add a new action to the current transaction set
*/
void acttab_action(acttab *p, int lookahead, int action){
  if( p->nLookahead>=p->nLookaheadAlloc ){
    p->nLookaheadAlloc += 25;
    p->aLookahead = realloc( p->aLookahead,
                             sizeof(p->aLookahead[0])*p->nLookaheadAlloc );
    if( p->aLookahead==0 ){
      fprintf(stderr,"malloc failed\n");
      exit(1);
    }
  }

View on GitHub (pinned to 3b8293bd65)