🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How to Make Sure that Buffer use ONLY memory

#6050
From: Andrue Cope [TeamB]
Date: Mon, 13 Jun 2005 10:08
33 lines
2579 bytes
JD wrote:

> > [...] if i'll use 'new' the allocation will be ONLY in
> > the 'real' memory without that 'paging' thing that use tha
> > hard-drive as part of the memory?
> 
> Correct. 'new' will throw if it can't allocate from RAM but
> there's a twist that I forgot to mention. Available memory
> often does not equal the largest memory block available.

Are you sure? Windows is usually very proactive in swapping out unused
memory. I suppose it depends on what flags the Heap Manager passes
through to GlobalAlloc. By default it uses GMEM_MOVEABLE. Doesn't that
mean that the OS can swap the blocks out to disk if it wants to?

I just checked with my colleague what we do, though, and it seems we
don't take any steps to lock the addresses into physical RAM. He
vaguely recalls that he got blue screens or other serious stability
issues when he tried to do that. This might be because we check how
much physical RAM is available and allocate 90% of that using new. If
you do that and prevent the OS from paging it out you don't leave much
room for anything else to run.

FWIW our application /seems/ not to swap its tables out to disk
normally but then it's a hash table so is continually getting hit
across its entire range. Additionally the application is a CPU hog and
users know not to do anything else while its running. If you try to run
other applications then it /will/ swap and runs like a dog.

-- 
Andrue Cope [TeamB]
[Bicester, Uk]
http://info.borland.com/newsgroups/guide.html
Technical Details
Message-ID: <42ad5b23@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <42ab3793$1@newsgroups.borland.com> <gjmna117s71qnpihpbtg7sqmbbvaob90q6@4ax.com> <42abfa21$1@newsgroups.borland.com> <42ac35d0$1@newsgroups.borland.com> <42ac8a8a$1@newsgroups.borland.com> <42acebc2$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,93efc3d53d15c3e4
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Andrue Cope [TeamB]" <no.spam@not.a.valid.address>
Subject: Re: How to Make Sure that Buffer use ONLY memory
Newsgroups: borland.public.cppbuilder.nativeapi
References: <42ab3793$1@newsgroups.borland.com> <gjmna117s71qnpihpbtg7sqmbbvaob90q6@4ax.com> <42abfa21$1@newsgroups.borland.com> <42ac35d0$1@newsgroups.borland.com> <42ac8a8a$1@newsgroups.borland.com> <42acebc2$1@newsgroups.borland.com>
Date: Mon, 13 Jun 2005 11:08:39 +0100
User-Agent: XanaNews/1.17.4.1
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
NNTP-Posting-Host: 217.207.223.34
Message-ID: <42ad5b23@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1118657315 217.207.223.34 (13 Jun 2005 03:08:35 -0700)
Lines: 33
X-Authenticated-User: acope
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail