In Csharp or Java, you cannot delete an object. You can only mark them available for deletion. The memory will be freed by the garbage collector. The garbage collector may not work during the life of your application. However, it will most likely work. When your system runs out of resources, this is the most likely time that the GC routines start at run time. And when resources are low, GC becomes the highest priority thread. Thus, your application will be executed. However, you can minimize the effect by calculating the correct load and the required resources for your application lifetime and be sure to purchase the right equipment that is enough for this. But you cannot just evaluate your performance.
Besides just GC, a managed application does get a little overhead compared to a traditional C ++ application because of the extra delegation layer. And a small performance panel for the first time, since the startup time should be up and running before your application starts up.
source share