How does one effectively dispose a StringBuilder
object? If an user generates multiple reports in a single sitting, my app ends up using a huge amount of memory.
I've read in a few sites online that the follow may help:
StringBuilder sb = new StringBuilder(1000000);
// loop goes here adding lots of stuff to sb
exampleObject.Text = sb.ToString();
sb.Length = 0;
Does the last line really help? Any other way of dealing with this?
NB: This does not really stop my users from continuing to use the application. I'm just wondering if there is a way of avoiding redundant memory usage.