Explicitly freeing memory in c#

前端 未结 9 718
刺人心
刺人心 2020-12-01 01:12

I\'ve create a c# application which uses up 150mb of memory (private bytes), mainly due to a big dictionary:

Dictionary Txns = new Diction         


        
9条回答
  •  一向
    一向 (楼主)
    2020-12-01 02:05

    Do you need the memory back? The memory is available, it's just not being reclaimed. You should not clear the dictionary, hold a weak reference to it and let the runtime do its job.

    If you want to see really deep into what's going on, check out the .NET Memory Profiler. That will give you visibility into exactly what's happening with your object, what generation it is, what memory is being used by what and on and on. :)

提交回复
热议问题