{"record":{"id":"175748056d58b5cf","repo":"dotnet/runtime","slug":"outofmemory","errorCode":null,"errorMessage":"\nOutOfMemory!\n","messagePattern":"\nOutOfMemory!\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/coreclr/ilasm/method.cpp","lineNumber":56,"sourceCode":"    m_FirstDocument = NULL;\n    m_HasMultipleDocuments = FALSE;\n\n    // move the PInvoke descriptor (if any) from Assembler\n    // (Assembler gets the descriptor BEFORE it calls new Method)\n    m_pPInvoke = pAssembler->m_pPInvoke;\n    pAssembler->m_pPInvoke = NULL;\n\n    _ASSERTE(pszName);\n    if (!pszName) return;\n\n    m_szName = pszName;\n    m_dwName = (DWORD)strlen(pszName);\n\n    m_ExceptionList = new COR_ILMETHOD_SECT_EH_CLAUSE_FAT[MAX_EXCEPTIONS];\n    m_EndfilterOffsetList = new DWORD[MAX_EXCEPTIONS];\n    if((m_ExceptionList==NULL)||(m_EndfilterOffsetList==NULL))\n    {\n        fprintf(stderr,\"\\nOutOfMemory!\\n\");\n        return;\n    }\n    m_dwMaxNumExceptions = MAX_EXCEPTIONS;\n    m_dwMaxNumEndfilters = MAX_EXCEPTIONS;\n\n    m_Attr          = Attr;\n    if((!strcmp(pszName,COR_CCTOR_METHOD_NAME))||(!strcmp(pszName,COR_CTOR_METHOD_NAME)))\n        m_Attr |= mdSpecialName;\n    m_fEntryPoint   = FALSE;\n    m_fGlobalMethod = FALSE;\n\n    if(pbsSig)\n    {\n        m_dwMethodCSig = pbsSig->length();\n        m_pMethodSig = (COR_SIGNATURE*)(pbsSig->ptr());\n        m_pbsMethodSig = pbsSig;\n    }\n","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/coreclr/ilasm/method.cpp#L38-L74","documentation":"The Method constructor (method.cpp:52-53) pre-allocates fixed arrays for exception handlers and endfilter offsets (`new COR_ILMETHOD_SECT_EH_CLAUSE_FAT[MAX_EXCEPTIONS]` and `new DWORD[MAX_EXCEPTIONS]`). If either allocation returns NULL, ilasm prints OutOfMemory and returns, leaving the method unable to track exceptions. This is the method-level analogue of error 220.","triggerScenarios":"Assembling a file while the process is under severe memory pressure; an extremely large number of methods causing many simultaneous allocations.","commonSituations":"CI with tight memory limits; assembling a machine-generated assembly with many methods on a 32-bit build.","solutions":["Free memory on the host or move to a 64-bit ilasm build.","Reduce the size of the assembly (fewer methods / split modules).","Increase the container/CI memory limit."],"exampleFix":"// before: single huge assembly with tens of thousands of methods\nilasm /out=huge.dll huge.il   # OutOfMemory!\n// after: split into smaller modules then merge\nilasm /out=part1.dll part1.il","handlingStrategy":"validation","validationCode":"// Warn before assembling if the module has an extreme method count\n// (each Method pre-allocates two fixed arrays).\nif (methodCount > 100000) warn('Large method count; ilasm may hit per-method OOM on low-RAM hosts');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use 64-bit ilasm for large assemblies.","Split very large assemblies into modules.","Provision adequate memory in CI runners."],"tags":["ilasm","memory","method","out-of-memory"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}