{"record":{"id":"e5d72d216750f9ec","repo":"dotnet/runtime","slug":"out-of-memory-e5d72d","errorCode":null,"errorMessage":"\nOut of memory!\n","messagePattern":"\nOut of memory!\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/coreclr/ilasm/assembler.h","lineNumber":498,"sourceCode":"                bytes += 4;\n                break;\n            case SERIALIZATION_TYPE_STRING:\n                length = (int)strlen((const char *)&pVal[1]);\n                bytes += CPackedLen::Size(length) + length;\n                break;\n            case SERIALIZATION_TYPE_ENUM:\n                length = (int)strlen((const char *)&pVal[1]);\n                bytes += CPackedLen::Size((ULONG)length) + length;\n                bytes += 4;\n                break;\n            }\n            p = p->Next();\n        }\n\n        m_Blob = new BYTE[bytes];\n        if(m_Blob==NULL)\n        {\n            fprintf(stderr,\"\\nOut of memory!\\n\");\n            return;\n        }\n\n        m_Blob[0] = 0x01;           // Version\n        m_Blob[1] = 0x00;\n        m_Blob[2] = (BYTE)action;   // Constructor arg (security action code)\n        m_Blob[3] = 0x00;\n        m_Blob[4] = 0x00;\n        m_Blob[5] = 0x00;\n        m_Blob[6] = (BYTE)count;    // Property/field count\n        m_Blob[7] = (BYTE)(count >> 8);\n\n        for (i = 0, pBlob = &m_Blob[8], p = pairs; i < count; i++, p = p->Next()) {\n            BYTE *pVal = (BYTE*)p->Value()->ptr();\n            char *szType;\n\n            // Set field/property setter type.\n            *pBlob++ = SERIALIZATION_TYPE_PROPERTY;","sourceCodeStart":480,"sourceCodeEnd":516,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/coreclr/ilasm/assembler.h#L480-L516","documentation":"ilasm failed to allocate the byte buffer that backs a serialized custom-attribute / security-declaration blob. In Assembler (assembler.h:495) the blob size `bytes` is computed from the number of name/value pairs and their string lengths, then `m_Blob = new BYTE[bytes]` is attempted; when the allocator returns NULL (nothrow), ilasm prints this message and returns from the constructor, leaving the blob un-built. It indicates the process ran out of address space or the computed size was pathologically large.","triggerScenarios":"Assembling IL that declares an extremely large set of custom attributes or security permission sets (many named fields / long string values); running ilasm on a machine under heavy memory pressure or a 32-bit build near the 2-4GB ceiling.","commonSituations":"CI agents with low memory limits; a script/IL-generator that emits thousands of attribute pairs; a 32-bit ilasm binary assembling a huge generated assembly.","solutions":["Reduce the number/size of custom attributes and security declarations in the IL source being assembled.","Re-run ilasm on a machine with more free memory, or close other large processes first.","Use the 64-bit (amd64/arm64) build of ilasm so the process has a larger address space.","Split the assembly into smaller modules and merge with ILMerge/al instead of one huge file."],"exampleFix":"// before: thousands of permission pairs fed into one declaration\n.permissionset assert = (n many long strings ...)\n// after: trim to only the permissions actually required\n.permissionset assert = (fewer, shorter entries ...)","handlingStrategy":"validation","validationCode":"// Before invoking ilasm, sanity-check attribute counts in generated IL.\n// (Pseudo) warn if a single type declares > N custom-attribute/security pairs.\nif (maxAttributePairsPerType > 1024) {\n    warn(\"IL declares %zu attribute pairs; risk of OOM in blob alloc\", maxAttributePairsPerType);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run the 64-bit ilasm to maximize address space.","Cap attribute/security-declaration counts in IL generators.","Monitor ilasm RSS in CI and fail early on memory growth."],"tags":["ilasm","memory","custom-attributes","out-of-memory"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}