C# dictionary - how to solve limit on number of items?

后端 未结 8 799
不知归路
不知归路 2020-12-21 03:54

I am using Dictionary and I need to store almost 13 000 000 keys in it. Unfortunatelly, after adding 11 950 000th key I got an exception \"System out of memory\". Is there a

相关标签:
8条回答
  • 2020-12-21 04:28

    With that many keys, you should either use a database or something like memcache while swapping out chunks of the cache in storage. I'm doubting you need all of the items at once, and if you do, there's no way it's going to work on a low-powered machine with little RAM.

    0 讨论(0)
  • 2020-12-21 04:31

    Easy solution is just use simple DB. The most obvious solution in this case, IMHO is using SQLite .NET , fast, easy and with low memory footprint.

    0 讨论(0)
提交回复
热议问题