I need to build a big list of strings and keep it in memory, however while building it an OutOfMemoryException is thrown. According to Resource Monitor I still have 1GB of memory available. I found this KB article addressing the issue, but it seems like it should have been fixed in framework 1.1 SP1 (I am using 3.5 sp1).
Can anybody shed some light on what happens behind the scenes? Does the .net framework limit how much memory can be used by a single process (on a 32 bit system)? If so I can see why, but what doesn't make sense is that the application is only using 1.6GB and there is still ~1GB left to the system.
Edit - For those who asked here is some more in-depth information:
I have a List (Yeah, I could use something else, but I am just prototyping right now.), I generate a random string by doing a Guid.NewGuid().ToString(), and throw it in the list. What I am trying to do is generate a list with as many items as I can fit into it, and test different methods of looking up a specific one. My first guess was that some fragmentation is going on, but I dropped everything except the code below, and it still happens. I don't think this little snippet could create a lot of fragmentation, but I'm probably wrong.
List<string> blah = new List<string>();
for (int i = 0; i < 50000000; i++)
{
blah.Add(Guid.NewGuid().ToString());
}