简体   繁体   中英

How Do I Fix Visual Studio 2022 Out of Memory Issue?

I went through every possible configuration option I could find both on Stack and in Docs to disable anything remotely extraneous in Visual Studio 2022 running my C# Blazor Server-Side Application. This mainly meant disabling things such as code in the taskbar and enabling Just My Code options - mostly Text Editor and Debugging Tool options.

When I launch the project, the overall memory load hits ~1.5GB in Task Manager and then I receive out of memory errors despite having nothing else running and 64GB of RAM. I know that this is due to the inherent memory limits of 64-bit applications, but I thought that VS 2022 was now 64-Bit and thus the limit is supposed to be 4GB and not 2GB. I did specify a 64-Bit processor only for debugging purposes as well.

I am running on Windows 11, and I cannot get an editbin.exe post build event to work - I have tried multiple examples I found to no avail. Obviously, I have no Linker options given that this is C#.

Does anybody know how to overcome this issue?

When I launch the project, the overall memory load hits

This sounds to me that not visual studio is maxing out of memory but your Project.
You can see this in the Diagnostic tools on the right. These show the current resource usage of your project. These are separate from visual studio:
在此处输入图像描述

Eventhough Visual Studio is compiled in 64 Bits, Applications are compiled in 32 bits per default. You can change this the folloring way:

  1. In the Drop down Any CPU at the top, hit the drop down menu. Any CPU means x86 (32 bit) and x64 (64 bit) x64 processors can also run x86 (32 bit) programs:
    在此处输入图像描述

  2. open the Configuration Manager from the drop down:
    在此处输入图像描述

  3. select the dropdown platform . choose Create New... 在此处输入图像描述

  4. select x64 and press OK :
    在此处输入图像描述

  5. You configuration manager now might look like this (maybe need to apply the active solution platform separately):
    在此处输入图像描述

  6. You can now choose between 32 bit and 64 bit on the top:
    在此处输入图像描述

However, most probably, it is a code optimisation issue and not a matter of too little memory. But for that there is not enough information about what your project is trying to archieve

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM