简体   繁体   中英

Is there any Alternative of Dictionary<Key, Value> with non contiguous memory allocation in C#

Using Dictionary<Key, Value> causing issues in memory allowing ( error Failed to allocate memory) in the application So is there any alternative which is allocate memory in non contiguous form.

I tried with sortedList<Key, Value> collection but doesn't work out

Memory allocation will be based on the objects you add to the dictionary (or HashSet or SortedList, or any kind of list).

If you want to keep fixed sized of items in your dictionary, you can pass the capacity for the dictionary when instantiating it. Or you can use Stack<TItem> with capacity so you can push/pop.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM