Bsod after debugging program?
Replies: 4   Views: 2498  Subscribers: 2

Posted by reece · 13-05-2012 - 06:06

At first thought I am dumb founded because I did not realize that an application alone could be capable of something like this.­
Programs are often the culprit of most BSOD's, that said an operating system is also comprised of programs (window manager, drivers etc), even the kernel is a program. The kernel usually delegates permission to access a region of memory and is the least likely culprit of a BSOD not that is impossible for it to happen. ­
Randomly I get the BSOD(blue screen of death) and it says: 'PROCESS_HAS_LOCKED_PAGES' and at the bottom 'dumping physical memory to disk'.­
The message within the BSOD stating that 'process has locked pages' would indicate to me at least that possibly some threads have locked memory blocks for the duration of its process while other processes are trying to access that memory block. I could be mistaken though. I believe locked blocks of memory by some of your processes are pending completion of another process, which is either depending on the value of that memory location or spawning more threads suffering the same fate. In the end you could have a large number of threads which have an interdependency on the result of the last and so if each thread is trying to access memory locked by another and is pending completion of the other to release access to it then nothing will move forward. If this is the case then the OS might realise this and decide to panic. I could be wrong of course. But this is what i suspect is the cause. I am really not that keyed up on how the kernel handles such events or further more the area of debugging complex multi threaded programs. However it could be a good start. If you have a decent debugger for C# though, i suggest monitoring the state of threads and seeing if they are in a state of pending access to locked memory. If the number of threads pending and hanging increasing until practically nearly all the threads are locked, you may need to rethink your strategy. I did find this interesting resource of memory locking, though it pertains to GNU C, most of the information is of a much lower level in nature and not exclusive to the language itself. ­Locked Memory­ which also has a link in the article pertaining to limits set on memory by the system for use in a process instance found ­here­