Re: Memory Limit
- From: nathan@xxxxxxxx (Nathan Mates)
- Date: Tue, 21 Aug 2007 16:48:17 -0000
In article <18557EC7-FD90-40F6-83B2-3F7E67DC7A05@xxxxxxxxxxxxx>,
=?Utf-8?B?bXVzdGFmYQ==?= <mustafa@xxxxxxxxxxxxxxxx> wrote:
I would like to make some calculation on a huge double array. Size of the
array will be:
double Cube [512][512][1024];
Doubles are 8 bytes each, so an array of that size would consume
2147483648 bytes, or 2GB exactly. You should be able to make this fit
on your system (WinXP, 2GB RAM) if you do the following:
1) Put that array on the heap. Not the stack. Don't even think about
putting that on the stack.
2) For your exe (and all associated DLLs), in VS2005, go to project
properties -> Linker -> System -> Enable Large Addresses, and set that
to "Support Addresses larger than 2GB."
3) I'd also recommend going to project properties -> C/C++ -> General
-> Detect 64-bit Portability Issues, set to "Yes". Fix *everything*
found. This is not necessary, but will help you should you go to a
64-bit OS later.
4) Turn on the /3GB option in Windows's boot.ini. See
http://support.microsoft.com/kb/289022 and
http://www.microsoft.com/technet/sysinternals/information/bootini.mspx
And, reboot. Note: not all apps are happy with this turned on.
As you only have 2GB of RAM, your HD will get quite a workout
trying to keep up with constant accesses to a 2GB array. (And, your HD
will probably be encouraged to an early retirement.) I really
encourage you to put a third gig (e.g. a pair of 512MB memory sticks,
if your motherboard requires pairs, and you've got open slots) or
more.
All of the above assumes that you can't shrink your array sizes.
If you go much bigger, then you probably may well need a 64-bit OS and
compiler (VS2005 Express & Standard Editions don't compile for
64-bit). Most CPUs sold in the past 2-3 years are 64-bit capable; I'd
also recommend having at least 1GB more RAM than your array sizes.
Nathan Mates
--
<*> Nathan Mates - personal webpage http://www.visi.com/~nathan/
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A. Heinlein
.
- Follow-Ups:
- Re: Memory Limit
- From: mustafa
- Re: Memory Limit
- Prev by Date: Re: Share .cpp and .h along projects
- Next by Date: Re: Template member function cast bug in VC80SP1 (and more...)
- Previous by thread: Re: threads number
- Next by thread: Re: Memory Limit
- Index(es):
Relevant Pages
|
Loading