Insufficient memory to continue the execution of the program for C# WPF

Mojtaba_Hakim 321 Reputation points
2023-06-21T19:16:57.6866667+00:00

Project: I had Accounting project made in MS Access ADP 2003 project that connects to SQL Server database , Because it is not possible to create a beautiful and modern user interface with animation in Access, I decided to rewrite my program, I want to Convert that project to a project to be able to have fast speed program and have beautiful UI with animation and feature that user be able to change theme of Whole application to Dark or Light so I stated C# WPF.

Project info: C# WPF with .NET Framework 4.7.2 , also I used Material Design for set Dark/Light Theme for WHOLE Application

OS: Windows 10 x64 with 8GB RAM

ScreenShot:6C811

Codes: Invoice Window ↓

XAML: https://pastebin.com/zrdZxHfe

C# : https://pastebin.com/0iK8CbBs

My project has a very high RAM consumption, but now that my project is big,In my MainWindow when I want to load a window, I get the following error:

private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            new HEAD_LST_FROOSH22().Show();
        }

Error:

System.OutOfMemoryException: 'Insufficient memory to continue the execution of the program.

What have I try:

The state before the execution of that window : Ya1jL

Performance Profiler : nVMZk

I tried to provide all the data needed to check this error, this is a general error and no one can comment with the summary code. I don't expect anyone to read the entire code, but someone can give an opinion or a clue with a glance.

thanks all


Update :

I create A small C# WPF to Test UI because I was suspected to "[Material Design]"

so here it is :

User's image

Developer technologies Windows Presentation Foundation
Developer technologies .NET Other
SQL Server Other
Developer technologies C#
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2023-06-21T19:27:40.0133333+00:00

    your access app used virtual scrolling for database lists. you are probably loading database lists into memory, and then binding to a view. this doubles the memory use.

    you will probably need to implement virtual scrolling or paging. while you can find controls that support virtual scrolling, there is no simple database solution other than paging.

    0 comments No comments

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.