www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - allocating gobs of memory to my program

reply Charles McAnany <mcanance rose-hulman.edu> writes:
Hi, all. I'm back! I've got an enormous array that I need to store,
preferably in RAM. (It's iterated a bunch.)
I have 16 Gb on my machine, and at any time, about 12 Gb is free.
I'd like to be able to use about 10 Gb for this program. But when I
try to use more than about 800 Mb, I get "Memory allocation failed."
(I'm using new long[], not malloc(), but I do free() variables
because the garbage collector was having trouble keeping up with
me.) Is there a switch I can mark to say that the runtime might have
to deal with lots of memory?
Incidentally,
Win7 x64, Intel I7  4.4 GHz, compiling with dmd -O -release -inline.

Thanks,
Charles
Jun 16 2011
parent reply David Nadlinger <see klickverbot.at> writes:
On 6/17/11 12:32 AM, Charles McAnany wrote:
 Win7 x64, Intel I7  4.4 GHz, compiling with dmd -O -release -inline.

Regardless whether you are running on x86 or x86_64, DMD is only able to create 32 bit binaries on Windows. David
Jun 16 2011
next sibling parent Charles McAnany <mcanance rose-hulman.edu> writes:
Hm. I'm not too good on architecture - does that mean it's impossible for an
x32 program to have access to more memory? 
Is there, maybe, an x64 C library that I could use to abstract the memory out
(Just a huge array wrapper, basically)? Or, that failing, does GCC
automatically generate x64 code on an x64 machine? I could probably write the
procedure in C... but yuck.

David Nadlinger Wrote:

 On 6/17/11 12:32 AM, Charles McAnany wrote:
 Win7 x64, Intel I7  4.4 GHz, compiling with dmd -O -release -inline.

Regardless whether you are running on x86 or x86_64, DMD is only able to create 32 bit binaries on Windows. David

Jun 16 2011
prev sibling parent Jose Armando Garcia <jsancio gmail.com> writes:
On Thu, Jun 16, 2011 at 10:20 PM, Charles McAnany
<mcanance rose-hulman.edu> wrote:
 Hm. I'm not too good on architecture - does that mean it's impossible for an
x32 program to have access to more memory?
 Is there, maybe, an x64 C library that I could use to abstract the memory out
(Just a huge array wrapper, basically)? Or, that failing, does GCC
automatically generate x64 code on an x64 machine? I could probably write the
procedure in C... but yuck.

 David Nadlinger Wrote:

 On 6/17/11 12:32 AM, Charles McAnany wrote:
 Win7 x64, Intel I7  4.4 GHz, compiling with dmd -O -release -inline.

Regardless whether you are running on x86 or x86_64, DMD is only able to create 32 bit binaries on Windows. David


I don't know why you can't allocate more than 800mb but if you want to get around this by caching in other processes' memory then I can recommend memcache: http://memcached.org/
Jun 16 2011