{"record":{"id":"51b32158aaba0761","repo":"dotnet/runtime","slug":"out-of-memory-51b321","errorCode":null,"errorMessage":"\nOut of memory!\n","messagePattern":"\nOut of memory!\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/coreclr/ilasm/asmman.cpp","lineNumber":43,"sourceCode":"        if(tmp)\n        {\n            WCHAR*  wz = (WCHAR*)(tmp->getBuff(L));\n            if(wz)\n            {\n                memset(wz,0,L);\n                MultiByteToWideChar(g_uCodePage,0,pb,-1,wz,l);\n                tmp->remove(L-(DWORD)u16_strlen(wz)*sizeof(WCHAR));\n#if BIGENDIAN\n                if (Swap)\n                    SwapStringLength(wz, (DWORD)u16_strlen(wz));\n#endif\n                delete pSource;\n            }\n            else\n            {\n                delete tmp;\n                tmp = NULL;\n                fprintf(stderr,\"\\nOut of memory!\\n\");\n            }\n        }\n        else\n            fprintf(stderr,\"\\nOut of memory!\\n\");\n        return tmp;\n    }\n    return NULL;\n}\n\nAsmManFile*         AsmMan::GetFileByName(_In_ __nullterminated char* szFileName)\n{\n    AsmManFile* ret = NULL;\n    if(szFileName)\n    {\n        //AsmManFile X;\n        //X.szName = szFileName;\n        //ret = m_FileLst.FIND(&X);\n        //X.szName = NULL;","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/coreclr/ilasm/asmman.cpp#L25-L61","documentation":"Printed in BinStrToUnicode() (asmman.cpp) when tmp = new BinStr() succeeded but tmp->getBuff(L) returned NULL — i.e. the BinStr could not allocate a buffer of L = sizeof(WCHAR)*inputLength bytes for the Unicode conversion. The function then deletes tmp, returns NULL. ilasm continues but the conversion is dropped.","triggerScenarios":"Assembling an IL source whose string/metadata tokens are so large that the WCHAR buffer (2 bytes per source byte) exceeds available memory. BinStrToUnicode is used for manifest/assembly-name string conversion during IL assembly.","commonSituations":"Very large generated .il files; embedded large binary blobs as strings; running ilasm in a memory-constrained container; 32-bit ilasm hitting address-space limits.","solutions":["Reduce the size of the input .il — split large embedded blobs or externalize resources.","Run on a 64-bit ilasm build with more address space.","Increase memory limits (cgroup/ulimit) for the process.","If reproducible, profile which BinStr is oversized and report an ilasm bug — getBuff should not silently fail."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# before assembling, sanity-check input size vs available memory\nILSIZE=$(stat -c%s huge.il 2>/dev/null || stat -f%z huge.il)\nAVAIL=$(awk '/MemAvailable/{print int($2*1024)}' /proc/meminfo)\n[ \"$((ILSIZE*4))\" -lt \"$AVAIL\" ] || echo \"warning: il size ~$((ILSIZE/1024/1024))MB, avail ~$((AVAIL/1024/1024))MB - OOM likely\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Split large .il inputs into smaller modules.","Run 64-bit ilasm with adequate memory.","Externalize large blobs as resources rather than inlining as strings.","Raise container/cgroup memory limits."],"tags":["ilasm","memory","out-of-memory","binstr","unicode"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}