I have a application that clients connect to via socket. The application is multi threaded, does lots of number crunching, and consumes a huge ammount of memory. (1.5 - 2 GB) Occasionally it throws this error in a seemingly simple area of code.
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Its not always on the same line, but its always in the same file, on a foreach loop. I'm wondering if theres some setting in VS 2008 thats causing it? Theres nothing weird going on it really just dies on a foreach loop iterating through a List. I'm pretty sure its not a threading issue because I am using lock() so i'm 100% sure that the Lists arnt getting modified by multiple threads at the same time. I've tried turning off compiler optimizations but it still does it every once in a while. Very annoying.
This is a very very rare occurance. I'm running the server in debug and this only happens like once every 12-48 hours.