🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #14831

Re: PageFaults... are they a problem??

#14831
From: MWP
Date: Thu, 31 Jul 2003 13:50
63 lines
3811 bytes
Thanks for the long reply.

My app doesnt use a lot of ram (~6Mb max), and that ram isnt split up too much.

But i am accessing shared memory from external apps using OpenFileMapping and MapViewOfFile a lot (up to every 5ms).
Would this cause these page faults?

Thanks again.

>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: <3f291ea0$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3f28f191$1@newsgroups.borland.com> <VA.00001e5c.062c93ff@email.address.sorry>

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 07:01:59 PST
From: "MWP" <mwp@overclockers.com.au>
Sender: "MWP" <mwp@overclockers.com.au>
Reply-To: "MWP" <mwp@overclockers.com.au>
Subject: Re: PageFaults... are they a problem??
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 203.16.214.242 203.16.214.242    
X-Forwarded-For: unknown, 150.101.76.119
References: <3f28f191$1@newsgroups.borland.com> <VA.00001e5c.062c93ff@email.address.sorry>
NNTP-Posting-Host: 207.105.83.65
Message-ID: <3f291ea0$1@newsgroups.borland.com>
Date: 31 Jul 2003 06:50:24 -0700
X-Trace: newsgroups.borland.com 1059659424 207.105.83.65 (31 Jul 2003 06:50:24 -0700)
Lines: 64
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail