How to call a surrogate for Dispose() on StringBuilder objects(dotnettipoftheday.org)

submitted by manovichmanovich(755) 4 years, 7 months ago

How to release memory used by StringBuilder without calling System.GC.Collect().

1 comment |category: |Views: 82

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by dmihailescudmihailescu(25) 4 years, 7 months ago 0

As I've shown, it's setting Length = 0, or another less elegant alternative is to call Replace(string.Empty) on the StringBuilder object.
That should clear the internal memory without invoking the finalizer.

Reply

information Login or create an account to comment on this story