dotnet/runtime · error

Out of memory in Indx256::IndexString!

Error message

Out of memory in Indx256::IndexString!

What it means

Printed at src/coreclr/ilasm/asmtemplates.h:234 inside Indx256::IndexStringOneTable when allocating a new 128-element child-node table fails. This is the trie used by FIFO_INDEXED to map names to objects. An _ASSERTE fires in debug builds and the function returns NULL.

Solutions

  1. Increase process memory or run a 64-bit ilasm.
  2. Reduce the number of distinct labels/symbols in the input.
  3. Investigate upstream leaks; this code path only fails under pressure.
  4. For tooling that emits IL_<hex> en masse, consider batching the work.
Defensive patterns

Strategy: validation

Validate before calling

// Estimate trie memory before assembling: each unique key byte-prefix may allocate 128 Indx256 nodes.
// If unique_label_count * 128 * sizeof(Indx256) exceeds available memory, split the input.

Prevention

When it happens

Trigger: Triggered when `new Indx256[INDX256_TABLE_SIZE]` returns NULL while inserting a new label/name into the trie. Each unique key prefix can trigger a fresh 128-node allocation, so deeply diverse keys amplify the chance.

Common situations: ildasm-style output with huge numbers of unique labels (every instruction gets an IL_<hex> label), exhausting the heap. The header comment explicitly notes this pattern is memory-intensive.

Related errors


AI-assisted analysis of dotnet/runtime@60108ba66e (2026-08-10). Data as JSON: /api/errors/854672a4d2bdb68c. Report an issue: GitHub.

Appendix: source

Thrown at src/coreclr/ilasm/asmtemplates.h:234

    void ClearAll(bool DeleteObj)
    {
        if(DeleteObj) delete item;
        item = NULL;
        ClearOneTable(tableLow, DeleteObj);
        ClearOneTable(tableHigh, DeleteObj);
    };

private:
    T** IndexStringOneTable(Indx256*& table, BYTE value, BYTE* next, T* pObj)
    {
        // Ensure that child table exists.
        if(table == NULL)
        {
            table = new Indx256[INDX256_TABLE_SIZE] {};
            if(table == NULL)
            {
                _ASSERTE(!"Out of memory in Indx256::IndexString!");
                fprintf(stderr,"\nOut of memory in Indx256::IndexString!\n");
                return NULL;
            }
        }

        // Find the child node for the current BYTE at continue at the next BYTE.
        return table[value].IndexString(next,pObj);
    }

    T* FindStringOneTable(Indx256* table, BYTE value, BYTE* next)
    {
        if(table == NULL)
        {
            // If there are no child nodes, then there is nowhere to
            // look for this key.
            return NULL;
        }

        return table[value].FindString(next);

View on GitHub (pinned to 60108ba66e)