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.
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.