In .net 4.5 CLR team has change StringBuilder
class a lot. Here is the code reference for StringBuilder
class. Here we can find MaxChunkSize
equal to 8000 and comment above this field:
// We want to keep chunk arrays out of large object heap (< 85K bytes ~ 40K chars) to be sure.
// Making the maximum chunk size big means less allocation code called, but also more waste
// in unused characters and slower inserts / replaces (since you do need to slide characters over
// within a buffer).
So I still wonder, if we would work with StringBuilder
appending large string, e.g. :
var sb = new StringBuilder();
sb.Append(<<Here comes the string with length larger than 80 000 symbols>>);
Would we still have ChunksArrays allocated in LargeObjectHeap?