How do you free the system drum when creating and deleting custom controls

I have a C # application that consists of different screens, each of which is a corresponding user control. The application requires a lot of switching between different screens, as well as the intensity of the graphics. Each control is installed after the next control is called, and the garbage collector is called to free up system resources. The fact is that for some reason system memory is not released, and at some point after several screen changes it inevitably falls. Any ideas are greatly appreciated.

+3
source share
3 answers

If I were to guess, you are logging a lot of events using these controls, but you are not disinfecting them before they are "deleted", so they will not be collected by the GC.

That's a very difficult question. I would highly recommend investing in a decent memory profiler (hundie or two) to help you narrow down where the application crashes.

+2
source

It seems to me that you are not releasing all the controls. This may be because you simply forgot to release one, but once it has not been used, the garbage collector should still pick it up.

, , . , , , .

0

, ( ants), , . 2- , .

Red-gate 14- , , .

(, .NET Memory Profiler) , , Red-Gate , .

0
source

Source: https://habr.com/ru/post/1718024/


All Articles