very large string in memory

Posted by bushman on Stack Overflow See other posts from Stack Overflow or by bushman
Published on 2010-05-17T04:14:22Z Indexed on 2010/05/17 4:20 UTC
Read the original article Hit count: 412

Hi, I am writing a program for formatting 100s of MB String data (nearing a gig) into xml == And I am required to return it as a response to an HTTP (GET) request .

I am using a StringWriter/XmlWriter to build an XML of the records in a loop and returning the

stringWriter.ToString() 

during testing I saw a few --out of memory exceptions-- and quite clueless on how to find a solution? do you guys have any suggestions for a memory optimized delivery of the response?

is there a memory efficient way of encoding the data? or maybe chunking the data -- I just can not think of how to return it without building the whole thing into one HUGE string object

thanks

© Stack Overflow or respective owner

Related posts about memory

Related posts about memory-leaks