🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

what causes page files? etc

Started by
0 comments, last by Zer 24 years, 7 months ago
Welp, I used Spy++ and noticed that over three minutes my program racked up a little over 35,000 page faults. What could be causing these page faults? I assume they hurt performance slightly, so I'm wondering. In addition to what could be causing them, I am also wondering what can be done to eliminate them. IE5 has been running for over an hour and only has about 15k of them. Help help
Advertisement
Well, generally speaking, a page fault occurs when your program tries to access memory (code or data) that has been swapped out to disk for whatever reason. This results either when your program requires more memory than your system has, or if you're running other programs and their combined memory requirements are greater than your total amount of RAM.

It is a costly process to swap pages in and out, especially for games. High swapping is usually a result of poor design/coding (no offense intended, we all to it to some degree). To minimize them, firstly try to slim down your code. Smaller code is better anyways. Also, something that is somewhat of a lost art on the PC, conserve on memory and structure sizes. Try to allocate things all at once, or if using a 'cache' approach, allocate one big block and manage it yourself for each cache of memory. Doing memory allocation in a willy-nilly approach results in memory fragmentation, which can easily result in more pages of memory used than are truly needed.

Rock

This topic is closed to new replies.

Advertisement