Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you free system ram when creating and disposing user controls

I have a c# application that is composed of various screens which is each a respective user control. The application requires a lot of switching between the various screens and is also graphic intensive. Each control is disposed once the next control is invoked and the garbage collector is called to release the system resources. The thing is for some reason the system memory is never released and at some point after multiple screen changes it inevitably crashes. Any Ideas would be greatly appreciated.


1 Answers

If I had to guess, you're registering lots of events with these controls but not de-registering before they get "disposed", so they're not getting collected by the GC.

This is a hugely complex subject. I'd strongly suggest investing in a decent memory profilter (a hundie or two) to help you narrow down where your application is crashing.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!