Article View: borland.public.cppbuilder.nativeapi
Article #5832Re: Full Access to 2 GB memory RAM ?
From: Thomas Maeder [TeamB]
Date: Sun, 26 Jun 2005 15:39
Date: Sun, 26 Jun 2005 15:39
53 lines
2526 bytes
2526 bytes
"Deniel" <DenielMail@Internet.com> writes: > int MySize, *MyBuffer; > > MySize = 0.85 * pow( 2, 31 ); // 2^31 = 2GB > MyBuffer = new int[MySize ]; > > >>There is no portable way to achieve what you are looking for, and I >>also wouldn't expect there to be a way at all on most common >>platforms. > > I don't understand, where exactly is the problem? In your requirements :-) Most common platforms are multitasking systems. Now consider what happens if you start your program twice. Cf. http://blogs.msdn.com/oldnewthing/archive/2005/06/07/426294.aspx > If i whould wrtie this - > > MyBuffer = new int[200]; > > there whould be no problem right? Probably. Because the overhead per process is likely to hit a different system boundary before all the physical memory is used up if you try start your program the sufficient number of times to achieve the effect described above. > but if i write this - > > MyBuffer = new int[0.85 * 0x80000000]; // 85% of 2GB > > Then THERE WILL be a problem.... right? Yes. > So where does the problem starts? what is the limit size that > start making problems? It doesn't start at a specific number of ints per array, but at your requirement. There may be platforms that you can ask for memory that won't be swapped. The C++ language doesn't offer a portable way to access these APIs, though.
Technical Details
Message-ID:
<m2wtohf7q2.fsf@madbox2.local>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<42be94fa$1@newsgroups.borland.com> <m264w1goa3.fsf@madbox2.local> <42bec50a$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,256f8494310fe6f6
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Full Access to 2 GB memory RAM ?
References: <42be94fa$1@newsgroups.borland.com> <m264w1goa3.fsf@madbox2.local>
<42bec50a$1@newsgroups.borland.com>
From: maeder@glue.ch (Thomas Maeder [TeamB])
Organization: TeamB
X-Face: ":yn4zt^A_dn>6~{YJmu^B\'4w)e:apPM\VC=Dvf&*tASxX9|BYczkFd$xr.$vNSZ[3Uobr p]c4\+\l){!WQI.$]veP({HLd;CDYH?iN
Date: Sun, 26 Jun 2005 17:39:17 +0200
Message-ID: <m2wtohf7q2.fsf@madbox2.local>
User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)
Cancel-Lock: sha1:G0zMtfliZPS6rzoD4SCbXy5abLQ=
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
NNTP-Posting-Host: 84.73.0.67
X-Trace: newsgroups.borland.com 1119800370 84.73.0.67 (26 Jun 2005 08:39:30 -0700)
Lines: 53
X-Authenticated-User: tmaeder
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.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