While working on a new version of my iTunes Playlists to Xml application, I've been playing around with the existing code, for consolidation and speed.
While looking at memory usage, I played around with the StringBuilder I'm using to create the Xml output. As part of this I tried using Remove, once I had output the Xml, but experienced a large increase in used memory, after doing this.
StringBuilder someSB = new StringBuilder(); someSB.Append("Some data" + System.Environment.NewLine); someSB.Append("Some more data" + System.Environment.NewLine); // Trimmed textBox.Text = someSB.ToString(); someSB.Remove(0, someSB.Length - 1);
This jumped memory usage, on a pull using the defaults, against a 6460 item playlist, from ~17,000 to ~21,000 K, on my up-to-date Windows Vista Ultimate machine. Keeping the Remove() off, or just setting the StringBuilder to null, resulted in no jump of memory usage.
In the past I've used System.Text.StringBuilder.Remove(), thinking it would decrease memory usage faster, but it seems that's not the case.
I don't care all that much to discover why, at the moment, but if I decide to look about, I'll update this post or add a comment.
- How to Backup SNES Saves With the Super UFO Pro 8
- Review: Pfister Weller LG49-WR0K 2-Handle 8-inch Widespread Bathroom Faucet in Brushed Nickel
- Review: Sony HT-CT80 Soundbar Home Speaker
- Review: Petstages Channel Scratcher Catnip Blasted Scratching Post Station for Cats, Large
- Review: Anpro Stainless Steel Heavy-duty Fruit and Vegetables Masher, Potato Ricer
Support This Site
If my blog was helpful to you, then please consider visiting my Amazon Wishlist.