I’ve found the following code in my boss’s project:
Dim strBuilder As New System.Text.StringBuilder("", 1000000)
Before I call him out on it, I’d like to confirm whether this line actually sets a megabyte (or two megabytes in Unicode?) of memory aside for that one stringbuilder?
That initializes a
Char()of length 1000000.So the actual size needed in memory is 2000000 Bytes = ~2 MB since a char is unicode and needs 2 bytes.
Edit: Just in case your boss doesn’t believe, this is reflected with ILSpy: