How can I avoid the huge number of soft page faults generated by my C# .NET app?
I'm profiling a C# .NET WinForms application and i have noticed that it generates millions of soft page faults and keep increasing during the work ...
I know that in .NET the number of pages fault that an application generates is usually high, but millions of page faults seems too much... Seems that the application triggered a race condition with the GC, is it possible ?
Are there some known ill designed piece of code that can lead to this situation ? If not in the code is there some hidden settings of the .NET framework that can reduce the number of page faults ?
The generation of an increasingly high number of soft page faults can be avoided ?
I'd really recommends leaving this thing alone if it is not a problem. If you have performance problems though - Try and isolate the code that generates the most page faults - It is probably somewhere that you're using a large memory footprint object.
Try to keep your "unsafe" code as isolated and simple as possible, ie. encapsulate all the unsafe code in a class or function. Keep in mind that messing the .NET GC could lead to complications mostly unneeded.
Check this article for a bit of unsafe introduction (It's a bit old but still true): http://www.codeproject.com/KB/cs/unsafe_prog.aspx
Also, you could raise the time until the GC collects, this might help
链接地址: http://www.djcxy.com/p/56480.html上一篇: Google Protocol Buffers:parseDelimitedFrom和writeDelimitedTo for C ++