I have a small application that builds up a xml document using XDocument. However, after a while the app is using more than 1gb ram.
So I was wondering if there is anyway to make XDocument use the disk instead of in-memory. For example by opening a StreamWriter and save it to a file on the go.
Thank you in advance.
Assuming you refer to the .net XDocument, you can instead use a XmlWriter (tutorial). The XmlWriter can be attached to any stream you like by using the XmlWriter.Create() method.