Looking at it in terms of strictly centralized memory, what are the pros and cons of using System.IO.MemoryStream and System.String as a representation in memory.
Some of the factors I'm trying to research are as follows:
- How these objects operate in a [hypothetical] highly fragmented low memory environment
IMO, MemoryStream is only useful when encoding is trivial (e.g. ASCII, ISO-8859-X, etc.). If the encoding is UTF-8 and , you have non-ASCII characters, processing will be more difficult. Of course, a MemoryStream will almost certainly consume less memory, but otherwise not so much. Under the hood, a MemoryStream uses an array of bytes, which should also be allocated in an adjacent piece of memory.
- Actual size in memory (if the stream is UTF8, we almost halved the size)
To the right, with pure ASCII characters, a MemoryStream will consume half what the equivalent string consumes.
- Is there another object that I did not think about?
List<byte>
How are rows stored in a database? varchar or nvarchar?
Hi,
Andreas
Andreas Huber
source share