Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Performance / September 2003

Tip: Looking for answers? Try searching our database.

Excessive page-faulting in .NET? (i.e. several million plus faults)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jon Rista - 31 Aug 2003 10:28 GMT
I am working on an application that edits SimCity4 .dat files. This is a
.NET application written in C#. The application sometimes outperforms a
similar C++ application, but I've noticed that other things seem to be
slower. I recently took a look at taskmanager, and noticed that my .NET
application had 1.7 million page faults, and its counterpart C++ application
had about 40 thousand. Both programs had been running for about 10 minutes,
and both had loaded and used roughly the same amount of data. I know that
.NET applications make VASTLY different use of memory due to .NETS automatic
memory management, but I had no idea that so many more page faults were
incurred as a result.

Does anyone have any links or information regarding the volume of
page-faults in a .NET application? I'd like to avoid using GC.Collect(), as
currently I don't use it at all in this application. I like to let .NET do
its thing with memory, but 1.7million page faults in 10 minutes of usage
seems a bit extreme, even for a .NET app. I greatly appreciate any help or
links.

Jon Rista
Jon Skeet - 31 Aug 2003 12:38 GMT
> I am working on an application that edits SimCity4 .dat files. This is a
> .NET application written in C#. The application sometimes outperforms a
[quoted text clipped - 13 lines]
> seems a bit extreme, even for a .NET app. I greatly appreciate any help or
> links.

Don't forget that in C# you often use reference type objects where you
might well use value type objects in C++. That means there's an extra
level of indirection, which can reduce locality of memory access,
leading to more page faults. It's only a guess, but that might be it...

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too

Frank Hileman - 31 Aug 2003 17:00 GMT
I imagine it is the GC. If you have a lot of GC it might traverse large
areas of memory. If you are using lots and lots of small objects you might
want to consider old-fashioned ways of memory management: pools (arrays) of
structs, with indices into the arrays instead of pointers. This will also
reduce memory consumption, but could improve or worsen locality of
reference, depending on your allocation pattern.

Another thing is just eliminate any boxing surprises. The CLR profiler can
spot these.

> I am working on an application that edits SimCity4 .dat files. This is a
> .NET application written in C#. The application sometimes outperforms a
[quoted text clipped - 15 lines]
>
> Jon Rista
Jon Rista - 01 Sep 2003 23:30 GMT
I've tracked the problem to a custom list control I've written. This is a
pure .NET control written from scratch, no ownerdrawing for the existing
windows listcontrol. Moving the mouse over the control causes TONS of GC's,
all the way up to GC level 2 (why that is I can't tell, I don't use any
GC.Collect() anywhere). When moving the mouse over the list or scrolling the
list, there are LOTS of promotions from Gen 0, anywhere from 600 to 1500
promotions. I don't understand why so many promotions would happen. Is there
any way to find out where and what is beeing promoted? And where the GC's
are actually happening? Thanks.

Jon Rista

> I imagine it is the GC. If you have a lot of GC it might traverse large
> areas of memory. If you are using lots and lots of small objects you might
[quoted text clipped - 29 lines]
> >
> > Jon Rista
Jason Smith - 22 Sep 2003 07:49 GMT
I may have missed this information, but could you clarify something for me?

*  What OS are you running?
*  How much RAM does your computer have?
*  How much RAM does Task Manager say your app is using?
*  What is the speed of the CPU?
*  Do you have an optical mouse, or a normal ball mouse?

Also, what exactly are you doing in the mousemove event?  Or is this
something that just seems to be coming from your customized controls?
Sounds like someone is either creating bitmaps or strings or something on
every mousemove event.

Of course, if you have sufficient RAM, you should not be seeing all these
page faults.  The (over)allocation of memory and the subsequent GC recovery
should all take place in plain-old RAM.  This is, of course, unless your
application is using vast amounts of RAM - in which case all bets are off.

And hey, the optical mouse thing was just to see if you were paying
attention!  :-)

> I am working on an application that edits SimCity4 .dat files. This is a
> .NET application written in C#. The application sometimes outperforms a
[quoted text clipped - 15 lines]
>
> Jon Rista

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.