| > > c# string size limit? length of string limit?
| > Limit of available contiguous free memory block or 2^31 chrs.
| Not quite - I believe the top bits of the length are taken for extra
| flags, and there's always an extra null terminator, so it's 2^30-1
| chars. Not that I expect it'll make a difference to anyone :)
| Jon Skeet - < XXXX@XXXXX.COM >
~skeet Blog: http://www.yqcomputer.com/
| If replying to the group, please do not mail me too
The CLR (currently) limits the size of an object to 2^31 bytes. That means
that the string buffer size is limited to (2^31 - size of the object header)
bytes, or 2^31-16 bytes or 2^30-8 = 1073741816 characters in .NET.
There is only a trailing null terminator if the buffer is large enough, in
the maximum case there isn't a null terminator.
Note that such string cannot be created on Windows 32 bit.