GC.Collect()

前端 未结 7 2087
伪装坚强ぢ
伪装坚强ぢ 2020-11-27 19:21

Ok, I\'ve read a couple of topics about it, but here it goes. Let\'s imagine I have an application where basically every now and then I will click on a button, a lot of thin

7条回答
  •  半阙折子戏
    2020-11-27 19:40

    Normally the GC is only called if you attempt to allocate new memory. If you don't run out of memory, you obtain 0% performance improvement from calling the GC. You have to have a pretty insanely resource intensive application to even come close to the limits of RAM on todays computers.

    If you program has lots of external resources(like files or COM/DCOM references), you potentially would want to call the GC.

    If calling the GC will give you peace of mind, then go ahead. It likely won't help, but it certainly wouldn't hurt.

提交回复
热议问题