views:

171

answers:

2

While I am still new to C# I'm curious if there is a way to tell windows that it needs to set aside X memory to run this application.

While debugging (F5) I occasionally get a random "error writing to protected memory" notice, and it's usually fine for a bit after I restart the version of Visual Studio. Once in a while it takes a windows Reboot. So I'm assuming I need to specify somewhere a larger memory size for windows to set aside and then collect later.

Thoughts?

+3  A: 

That's not a matter of specifying more memory. That sounds like either you've hit some corner case in the CLR, or you're using some unmanaged code which is misbehaving, or you've got some bad memory.

Do you ever see this problem when not debugging? Is it usually around the same area of code?

Jon Skeet
+2  A: 

There isn't anything you need to set in Visual Studio or your C# program to prevent this from occurring. It sounds like a more serious problem than that.

You might want to ask this question over at SuperUser.com and see if they have any ideas about the health of your machine and software.

As a person new to c#, you're not really using the unsafe keyword, are you? :)

The beta password for SuperUser can be found here.

Robert Harvey