• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

C# how to prevent outofmemoryexeption

Page 2 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.
Originally posted by: Crusty
Originally posted by: Dhaval00
Originally posted by: Crusty
I'm curious to know how long your string was when it crashed. Using a StringBuilder I was able to build a 137million length string before I got the exception, Task manager reported ~500MB usage.

If you look at the Console in the picture or while running the app, it actually shows the length of the string at the end of every iteration. In that screenshot, it was specifically 281,511,074. As a side note, up on reaching that limit, the application would come to a crawl before throwing the exception.

Lol oops... how could I have missed that link 😛


After reading some of the OP's post in more detail, I would suggest altering how you are storing your data.

Why not use the built-in serialization of .NET to store your data in flat files and store references to the flat files in the database. You get the best of both worlds. If you want to store your actual data in the database then you should use more then one field for an entire objects data... that kinda defeats the purpose of using a relational DB.

This.
 
Back
Top