Short answer: they are automatically released.
Only once, several years ago, I received an inexplicable memory leak due to the fact that the object was not released. At that time, I need to make an explicit call to the garbage collector to fix the problem.
I never found a real reason, maybe an error in the infrastructure, maybe something is related to the OS resource, but I can say that 99.99% of the time, you can be free from worrying about it in C #.
source
share