{"record":{"id":"854672a4d2bdb68c","repo":"dotnet/runtime","slug":"out-of-memory-in-indx256-indexstring","errorCode":null,"errorMessage":"\nOut of memory in Indx256::IndexString!\n","messagePattern":"\nOut of memory in Indx256::IndexString!\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/coreclr/ilasm/asmtemplates.h","lineNumber":234,"sourceCode":"    void ClearAll(bool DeleteObj)\n    {\n        if(DeleteObj) delete item;\n        item = NULL;\n        ClearOneTable(tableLow, DeleteObj);\n        ClearOneTable(tableHigh, DeleteObj);\n    };\n\nprivate:\n    T** IndexStringOneTable(Indx256*& table, BYTE value, BYTE* next, T* pObj)\n    {\n        // Ensure that child table exists.\n        if(table == NULL)\n        {\n            table = new Indx256[INDX256_TABLE_SIZE] {};\n            if(table == NULL)\n            {\n                _ASSERTE(!\"Out of memory in Indx256::IndexString!\");\n                fprintf(stderr,\"\\nOut of memory in Indx256::IndexString!\\n\");\n                return NULL;\n            }\n        }\n\n        // Find the child node for the current BYTE at continue at the next BYTE.\n        return table[value].IndexString(next,pObj);\n    }\n\n    T* FindStringOneTable(Indx256* table, BYTE value, BYTE* next)\n    {\n        if(table == NULL)\n        {\n            // If there are no child nodes, then there is nowhere to\n            // look for this key.\n            return NULL;\n        }\n\n        return table[value].FindString(next);","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/dotnet/runtime/blob/60108ba66eb7d1d12f595480091b4ad80a24b172/src/coreclr/ilasm/asmtemplates.h#L216-L252","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Increase process memory or run a 64-bit ilasm.","Reduce the number of distinct labels/symbols in the input.","Investigate upstream leaks; this code path only fails under pressure.","For tooling that emits IL_<hex> en masse, consider batching the work."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Estimate trie memory before assembling: each unique key byte-prefix may allocate 128 Indx256 nodes.\n// If unique_label_count * 128 * sizeof(Indx256) exceeds available memory, split the input.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Limit distinct label namespaces in the IL (especially IL_<hex> patterns).","Use 64-bit ilasm with more memory.","Consider batching ildasm-style output."],"tags":["coreclr","ilasm","out-of-memory","trie","template"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}