I am attempting to ascertain the maximum sizes (in RAM) of a List and a Dictionary. I am also curious as to the maximum number of elements / entries each can hold, and their
I think you have bigger issues to solve before even wondering if a Dictionary
with an int64
key will be useful in 5 or 10 years.
Having a List
or Dictionary
of 2e+10 elements in memory (int32
) doesn't seem to be a good idea, never mind 9e+18 elements (int64
). Anyhow the framework will never allow you to create a monster that size (not even close) and probably never will. (Keep in mind that a simple int[int.MaxValue]
array already far exceeds the framework's limit for memory allocation of any given object).
And the question remains: Why would you ever want your application to hold in memory a list of so many items? You are better of using a specialized data storage backend (database) if you have to manage that amount of information.