Article View: borland.public.cppbuilder.nativeapi
Article #14829Re: PageFaults... are they a problem??
From: Andrue Cope
Date: Thu, 31 Jul 2003 12:31
Date: Thu, 31 Jul 2003 12:31
52 lines
3636 bytes
3636 bytes
Mwp, > I kinda understand what PageFaults are, A page fault occurs when the CPU tries to access an address which is not backed by (IOW:present in) physical RAM. In response to a page fault the OS will attempt to allocate a page of RAM to back the address. Depending on why the page fault occurred this can quite a quick process (as when simply completing a lazy allocation) or slow (as when reading data back from the swap file - esp. if something else has to be thrown out). It's actually quite a fascinating aspect of OS design (well I think so) and there's quite a lot of documentation on the web. In Builder terms it could be one of: * You are reading/writing to an area of the heap that has been swapped out to disk. * You are reading/writing to an area of the heap that you have never accessed before and the OS is now scrambling to provide storage for you. The last I heard Windows NT and higher use a lazy allocation strategy so storage isn't actually allocated until you make use of it. You'll also get page faults when writing to a copy-on-write page but this is probably very rare for a Builder program. > but what i cant understand is why my BCB5 app creates so many. > Its creating about 1000 a second. If you are allocating a large amount of memory in small chunks this could happen. *This probably doesn't matter as long as the allocation isn't a runaway situation since it should calm down after a while.* It could also happen if you are allocating a small amount of memory but mixing your allocations such that the Heap Manager was unable to satisfy your requests from its free list. This is a problem that Borland's Heap Managers (Delphi and C++) have suffered from for as long as I know. Typically a mix of large/small allocations will have this effect even if they are being continually deallocated. IOW sometimes even though the instantaneous allocated total is low the Heap Manager may still be having to request memory from Windows. *This can be a problem as it affects performance and could eventually lead to an out of resources message*. It could also happen if you have allocated a lot of memory and are jumping around it a lot (a large hash list for instance). This is especially likely if your machine has small amounts of RAM or is running a lot of other memory hungry applications. *This is annoying but aside from the performance drop is unlikely to cause a crash*. -- Andrue Cope [Bicester, UK]
Technical Details
Message-ID:
<VA.00001e5c.062c93ff@email.address.sorry>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!green.readfreenews.net!news.readfreenews.net!news-xfer.cox.net!peer01.cox.net!cox.net!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3f28f191$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,ec1f290b7afbc30f X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-07-31 05:38:36 PST Date: Thu, 31 Jul 2003 13:31:49 +0100 Newsgroups: borland.public.cppbuilder.nativeapi Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Newsreader: Virtual Access by Atlantic Coast PLC, http://www.atlantic-coast.com/va Message-ID: <VA.00001e5c.062c93ff@email.address.sorry> Subject: Re: PageFaults... are they a problem?? From: Andrue Cope <not.a.valid@email.address.sorry> Reply-To: not.a.valid@email.address.sorry References: <3f28f191$1@newsgroups.borland.com> NNTP-Posting-Host: 217.207.223.34 X-Trace: newsgroups.borland.com 1059654771 217.207.223.34 (31 Jul 2003 05:32:51 -0700) Lines: 53 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!green.readfreenews.net!news.readfreenews.net!news-xfer.cox.net!peer01.cox.net!cox.net!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail