{"record":{"id":"abd895871d490afa","repo":"dotnet/runtime","slug":"out-of-memory-abd895","errorCode":null,"errorMessage":"\nOut of memory!\n","messagePattern":"\nOut of memory!\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/coreclr/ilasm/asmtemplates.h","lineNumber":104,"sourceCode":"\t\t\t\tif(m_ulOffset)\n\t\t\t\t{\n\t\t\t\t\tmemcpy(m_Arr,&m_Arr[m_ulOffset],m_ulCount*sizeof(T*));\n\t\t\t\t\tm_ulOffset = 0;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n                    m_ulArrLen = GrowBuffer(m_ulArrLen);\n\t\t\t\t\tT** tmp = new T*[m_ulArrLen];\n\t\t\t\t\tif(tmp)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(m_Arr)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmemcpy(tmp,m_Arr,m_ulCount*sizeof(T*));\n\t\t\t\t\t\t\tdelete [] m_Arr;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tm_Arr = tmp;\n\t\t\t\t\t}\n\t\t\t\t\telse fprintf(stderr,\"\\nOut of memory!\\n\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tm_Arr[m_ulOffset+m_ulCount] = item;\n\t\t\tm_ulCount++;\n\t\t}\n    };\n    ULONG COUNT() { return m_ulCount; };\n    T* POP()\n    {\n        T* ret = NULL;\n        if(m_ulCount)\n        {\n            ret = m_Arr[m_ulOffset++];\n            m_ulCount--;\n        }\n        return ret;\n    };\n    T* PEEK(ULONG idx) { return (idx < m_ulCount) ? m_Arr[m_ulOffset+idx] : NULL; };","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/coreclr/ilasm/asmtemplates.h#L86-L122","documentation":"Printed by FIFO<T>::PUSH in asmtemplates.h when the grow path's 'new T*[m_ulArrLen]' returns NULL. The array pointer is left unchanged but PUSH still writes to m_Arr at the (now too small) index — a latent correctness issue. As with 215, throwing new makes this branch effectively dead under standard semantics.","triggerScenarios":"FIFO (queue) template used by ilasm grows its backing array via GrowBuffer() (50% up to 2048) but the new allocation fails. Happens when assembling inputs that push many items through the queue.","commonSituations":"Large IL with many named items routed through a FIFO; memory-constrained process; 32-bit address space.","solutions":["Reduce input size or split the assembly.","Run 64-bit ilasm with more memory.","Raise process memory limits.","If patching ilasm, change 'new T*[...]' to 'new (std::nothrow) T*[...]' consistently and bail cleanly, or let std::bad_alloc propagate."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# shrink input before assembling; aim for well under available memory\nILSIZE=$(stat -c%s big.il 2>/dev/null || stat -f%z big.il)\n[ \"$ILSIZE\" -lt 268435456 ] || echo \"big.il is $((ILSIZE/1024/1024))MB - consider splitting\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Split large IL inputs to keep internal queues small.","Use 64-bit ilasm and generous memory limits.","Note that FIFO::PUSH on allocation failure leaves the array stale — treat any OOM as fatal."],"tags":["ilasm","memory","out-of-memory","fifo","template"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}