I need to pull large Unicode textual strings (e.g. 200Mb) from a Database (nvarchar) and store in memory for processing. i.e. I need random access to all parts of the strings.
Looking at this from strictly memory centric point of view, what are the pro’s and con’s of using a System.IO.MemoryStream versus a System.String as my in memory representation.
Some factors I am trying to research are:
- How these objects act in a [hypothetical] highly fragmented low memory environment
- Immutability
- Actual size in memory (if stream is UTF8, have we nearly halved size)
- Is there another object I have not thought about?
I am looking for clarity and advice on these points, as well as any other memory considerations I have not thought of?
Note: There may be better way of processing these strings, but at this point I am realy just asking about the memory consideration of storing such an object.