Setting C# Memory Parameters

给你一囗甜甜゛ 提交于 2019-12-25 07:57:41

问题


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?


回答1:


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?




回答2:


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.



来源:https://stackoverflow.com/questions/1268095/setting-c-sharp-memory-parameters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!