Re: Can 32-bit apps possibly access more than 4GB ???
On Dec 19, 5:15 am, Jonathan Lee <cho...@shaw.ca> wrote:
On Dec 18, 11:38 pm, "Peter Olcott" <NoS...@SeeScreen.com> wrote:
I am looking to create an application that needs lots of
memory. I don't want to write it as 64-bit code because
32-bit machines or 32-bit Windows probably could not run
these apps. In the ideal case I would like to write my
application such that it would run on any machine, and could
take advantage of whatever memory was available. What is the
best way to do this?
Not really a C++ question, but whatever...
- I'm pretty sure Windows and Linux use flat addressing for
memory so you'll only ever get 4GB maximum for a single
process. Dunno about the BSDs and other OS's.
First, both Windows and Linux are 64 bt OS's. (Well, Linux
depends on the system it's running on---it wouldn't surprise me
if there were a 36 bit port of Linux.)
- If you don't need all this memory _at once_ you could always
swap out to disk. Sort of... segment it.
You mean, like we did back in the 1970's, before virtual memory
became wide spread.
- You'll probably have to do something like that anyways since
no reasonable OS will give you that much memory. I think
Windows will cough up 2GB at most.
It depends on the configuration of the process. You can ask
for 3MB in some 32 bit modes, and of course, in a 64 bit mode,
you can ask for a lot more.
- I've never heard of a 32-bit machine w/ more than 4GB RAM
True, but who has 32-bit machines now adays?
- If you've got a cluster or are part of a distributed
computing platform you could spread the computation (and
memory requirements) around.
In short, break your data up into manageable chunks. Relative
to your resources, that is.
I think his initial problem (not expressed that clearly,
perhaps) is that he has an application which can require
variable amounts of memory, and he wants to make it "adaptable",
so that the same binary will run on a 32 bit machine, but will
use far more memory on a 64 bit machines. Off hand, the only
solution I see is to compile the actual code in both 32 bit and
64 bit modes, provide both binaries, and use a small starter
program which determines the architecture and starts the correct