Re: Memory Limit



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
.



Relevant Pages

  • Re: Which is faster--Array or ADO
    ... into RAM be it an array, or that of a reocrd set. ... one is not necessarily going to your processing speed because it is ram. ... read one record from disk into array ...
    (microsoft.public.access.modulesdaovba)
  • Re: Large strings and out of memory
    ... > RAM and even servers today are often configured with less than 2GB RAM I ... > that works with disk. ... The disk writes a 10M block once full then restarts, the dynamic array ... The disk array is not only far more controllable, ...
    (comp.lang.pascal.delphi.misc)
  • Re: Out of Memory Problem in VB 6.0 Application.
    ... that's a fixed size array. ... > block of memory. ... Just think of it as 2gigs of ram that you have at your disposal. ... matter if that's real ram or swap file it's still 2 gigs available to your ...
    (microsoft.public.vb.general.discussion)
  • Re: New install partitioning question
    ... or for when memory greedy servers overallocate RAM ... Since pagefile is only temporary, ... first partition on the array, but that's really just an inexact way to mock ... OS, Logs, Pagefile, Data and Apps. ...
    (microsoft.public.windows.server.setup)
  • Re: Static allocation failure?
    ... I am talking about an array that is declared with the static keyword, ... In fact, when I increased the heap size, it turns out that it works... ... While the first is, I believe, true, I wouldn't put it past any compiler writer to put your big array on the heap sometime before mainis run and keep it there. ... it _should_ be statically allocated in RAM -- but _is_ it statically allocated in RAM? ...
    (comp.arch.embedded)

Loading