- Home /
How to solve the OutOfMemoryException when a List is too big?
Am creating a list of vertices. I don´t know how many of them are they going to be, and they might be enough sometimes to throw the error. If am right, I can use , but I don´t know if that has performance implications or anything. And I don´t understand the documentation very well; it´s either intertwined with other stuff that makes it harder to understand or is not explained at all. I just know it happens because am adding a lot of data to the List.
Thanks in advance.
Answer by andrew-lukasik · Apr 18, 2021 at 04:42 PM
To fill an entire RAM using List<int>
it's length ( Count
) must be a multitude of
1 000 000 000
It's order of magnitude more probable that your algorithm for constructing such list is unnecessary, plain wrong or at least not well thought out in regards to hardware available today.
For the future, whenever you see a list of length 100 000
or more your
spider
programmer-senses should be tingling.