Suppressing C# garbage collection

后端 未结 6 1077
挽巷
挽巷 2021-02-08 09:26

My application allocates a large amount of memory (millions of small objects totaling several gigabytes) and holds onto it for a long time.

  1. Is .NET wasting time ch
6条回答
  •  情深已故
    2021-02-08 09:57

    You can stop the garbage collector from finalizing any of your objects using the static method:

    GC.SuppressFinalize(*your object*)
    

    More information here: link text

提交回复
热议问题