System.OutOfMemoryException because of Large Dictionary

前端 未结 4 1517
天命终不由人
天命终不由人 2021-01-13 06:02

I keep a large cache in a dictionary with value IEnumerable>. I remove items from the dictionary periodically and add

4条回答
  •  感动是毒
    2021-01-13 06:21

    It's quite possible that the GC is coming to your rescue for a lot of the time, but that you're just going beyond its capabilities sometimes.

    Just to be absolutely clear, is this a Dictionary or a Dictionary>>? If it's the latter, then perhaps you're holding onto references somewhere else?

    How large is your cache getting? Do you have monitoring to keep track of it? What makes you think it's the dictionary which is causing the problem? If you have control over how much you cache, have you tried reducing the size?

提交回复
热议问题