/3GB switch issues

G

Guest

My program needs to allocated more than 2GB of memory, so I followed the
instructions for the /3GB switch; adding the /3GB extension to the boot.ini
file, and I
set the /LARGEADDRESSAWARE bit in my executable. Before this change, my
executable showed a ~2GB total and free virtual address space available.
After the change, the executable showed a ~3GB total and free virtual address
space.
NOW comes my problems:

1. There was a stack overflow message when my Visual C++ compiled program
statically allocated 2GB of memory.
=> so I used the /STACK:2000000000 option to set the total size of the stack.
HOWEVER,

2. when I tried to set the stacksize to anything greater than 2GB, there was
an
error message that said there was not enough space to run the program.
failure to initialize. (I even made sure that the total heap and stack size
was around 2GB) WHY? the memorystatus showed that I had ~3GB of available
space!

3. I also know that the /3GB switch does not ensure 3GB of contiguous memory
space because of the holes around the 2GB boundary. However, why is there
still
an error when I try allocate 2GB of NON-contiguous memory? I did
char* array;
for(int i = 0; i < 2000000000; i++) {
array = new char;
}

4. I also played around with the heap size, which yielded the same effects
as the stack size. It also had a limit at 2GB. PLEASE help.
 
J

Jerry

You must have more than 3Gb of RAM installed to use the /3Gb switch. It is
not for use with the swap file.
 
G

Guest

I do have more than 3GB of RAM. When I played around with the size of the
chunks of memory allocated, it seemed to help a little bit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top