Answer the question
In order to leave comments, you need to log in
How to optimize memory usage when writing one-dimensional arrays to a list?
Hello.
My program loops about a billion one-dimensional arrays into a list.
List<string[]> arrList = new List<string[]>();
// Тело цикла повторяющееся много раз:
{
string[] arr = new string[5];
arr[0] = "некоторое целое число" + "";
arr[1] = "некоторое целое число" + "";
arr[2] = "некоторое целое число" + "";
arr[3] = "некоторая строка";
arr[4] = "некоторая строка";
arrList.Add(arr);
}
Answer the question
In order to leave comments, you need to log in
https://www.ozon.ru/context/detail/id/23816449/
https://habrahabr.ru/post/260047/ - 2) The minimum size of an instance of a reference type in memory.
An array occupies a non-separable piece of memory.
An array of integers stores the values of these numbers in its cells.
An array of strings stores in its cells the addresses of strings located elsewhere in memory.
Read about generations, assembly thresholds.
+ https://blogs.msdn.microsoft.com/ericlippert/2010/... The Truth About Value Types
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question