Assistance Required for Resolving "System.OutOfMemoryException" in Visual Studio

Hoshyar Hussein 0 Reputation points
2024-10-03T23:49:42.52+00:00

error

Subject: Help Needed with System Out-of-Memory Issue in Visual Studio

Hello Everyone,

I hope you're all doing well. I'm working on a project in Visual Studio that includes a large number of forms, user controls, and images used as icons. However, I am facing a problem where I am unable to make or save any changes to the project. When I try to implement modifications, I get the following error:

Error: "Exception of type 'System.OutOfMemoryException' was thrown."

I would appreciate any suggestions or solutions to resolve this issue.

Technologies Used:

  • C# Language with WinForms
  • Target framework: .Net Framework 4.7.2
  • Frameworks and Libraries:
    • AForge.Video.DirectShow
    • Dapper
    • Guna.UI2.WinForms
    • MaterialSkin
    • Zen.Barcode.Rendering.Framework
  • Database: MS SQL Server 2019 (Programmability)
  • IDE: Visual Studio 2019Project Specifications:
    • Number of Classes: 12
    • Number of User Controls: 23
    • Number of Forms: 51
    • Number of Images in Resources Folder: 395
    • Total Lines of Code: 22,876

Given these details, I would greatly appreciate any suggestions or solutions to address the memory issue. I look forward to your expert guidance.

Thank you for your time and consideration.

Best regards, [Hoshyar Hussein Mohammed]

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,903 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,951 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,231 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,063 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 67,406 Reputation points
    2024-10-04T00:42:50.5333333+00:00

    You could switch to the visual studio 2022 64 bit version.

    1 person found this answer helpful.

  2. Jiachen Li-MSFT 32,456 Reputation points Microsoft Vendor
    2024-10-08T01:58:16.2233333+00:00

    Hi @Hoshyar Hussein ,

    Earlier versions of Visual Studio is a 32-bit process, which means it can only use about 2 GB of memory. You can switch to Visual Studio 2022 (which is a 64-bit application), allowing the IDE to utilize more memory, especially for large projects.

    If you have many images in your resources folder, consider loading some of them from an external file or a CDN instead of embedding them directly into the project.

    Best Regards.

    Jiachen Li


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.