DRAWIMAGE() -> TONS OF PAGE FAULTS!

S

svd

Originally, I thought this was due to DoubleBuffer, but ran some further
experiments and discovered that page faults occur when calling DrawImage().
For example, create 2 images about 800x800, then call DrawImage to copy from
to the other (on say a mouse click). Notice about 600+ page faults occur
each time (the larger the area, the greater the number of page faults).

I have an application that calls DrawImage() once a second to update the
main screen, so after a few days, the page fault count is monsterous. I
swear this bogs down my system too.

Anyone else have this problem? Any solutions? Can someone report this as a
DEFECT.

Thanks,

Steve
 
B

Bob Powell [MVP]

You seem to have this idea that a page-fault is some kind of an error. It
isn't. It is simply the processor's way of keeping track of it's virtual
memory and signalling to the memory manager that it needs to swop a portion
of the page file.

If you have a small amount of RAM in the machine or if the system has a
large amount of programs and data loaded the paging requirements will be
high.

To cure the "problem" buy more RAM, optimise your swop-file perhaps by
making a big one and placing it on a separate, dedicated partition on a
disk. If your application has high memory requirements perhaps you will need
to specify a higher spec machine in the minimum requirements for your
product.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
F

Frank Hileman

These are probably soft page faults, not hard ones. Soft faults do not
require disk access:
http://blogs.msdn.com/greggm/archive/2004/01/21/61237.aspx
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvc60/html/optcode.asp

Pages read/sec should show you hard page faults in the performance monitor
(don't use the task manager for these things).

I imagine it is simply large images.


Regards,
Frank Hileman

check out VG.net: http://www.vgdotnet.com
Animated vector graphics system
Integrated Visual Studio .NET graphics editor
 
S

svd

Well, I have 512MB of ram and it never seems to grow to more than about 30%
of what I have available, even when the page faults are occurring.

Maybe page faults are not a bad thing, if not, why do they even bother
showing them in the task manager?

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top