Memory issue

Hi,

I am not sure how I could give you information about the following error. The code is too long to put here. The program make a large double array of size N.M.d and then work on M.d arrays for each (i=1; i<N; ++i) without declaring new variables or arrays on each step.
I ran program with N=10, M=10^6, and d=3 it works. But for M=2.10^6, VS gives me the following error message:

1
2
3
First-chance exception at 0x77C44B32 in free.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0033F01C.

If there is a handler for this exception, the program may be safely continued.


When I monitor my usage memory from windows task manager, I have still lots of memory (4GB). I shouldn't run out of it. But, the program stops giving the following error.

The gdb for g++ gives me the following error message:

1
2
3
4
5
6
7
      1 [main] free 2648 exception::handle: Exception: STATUS_ACCESS_VIOLATION
   1423 [main] free 2648 open_stackdumpfile: Dumping stack trace to free.exe.stackdump

Program received signal SIGSEGV, Segmentation fault.
pthread_mutex::pthread_mutex (this=0x40010006, attr=0x0)
    at /usr/src/debug/cygwin-1.7.17-1/winsup/cygwin/thread.cc:1705
1705      pshared (PTHREAD_PROCESS_PRIVATE)

I wonder what's happening here? How can I give you more info about the issue?
Windows. MS sets arbitrary limits on the memory addressable by single process. Is this a 32-bit or 64-bit binary?
It's 64-bit. Can I move up the limit?
Forgot to tell its a Windows 8 pro 64-bit.

P.S.: I regret buying a PC. It's quite a new machine and Linux does not support the hardware yet.
that looks like a stack overflow or corruption not the heap.

Does a recursion cause havoc? Or you may write something where you shouldn't write?
So, there is no way a PC can run a program which needs to use large memory, no matter how much memory is installed on your computer?
That sounds f**king stupid.
Last edited on
I found this address and changed the paging file limit to 7GB. I made a test problem which makes a array of large size. As soon as it uses 3GB of memory, I get the same error. Is that any way I can use more than this from my memory. All my 8GB memory is installed on one slot.
You say that you have 64-bit Windows. Do you compile your binary as 64-bit too?
Keskiverto,
I might not. How can I check it? How can I do it?
Which compiler do you use?

Note: TaskMan shows running processes and marks the 32-bit ones.
I use VS. I also tried cygwin. Both have the same issue. If I figure out I am running it as 32-bit, how can I run it as 64-bit?
With Visual Studio 2012 Express, I do compile on terminal, i.e. on command line. I have to load environment variables with a batch file. With appropriate parameter, it sets up the 32-bit compiler binary to produce 64-bit binaries.

IDE ... probably has the option somewhere, but I don't use IDE. Search the MS VS documentation (and the web).
With Visual Studio 2012 Express, I do compile on terminal, i.e. on command line. I have to load environment variables with a batch file. With appropriate parameter, it sets up the 32-bit compiler binary to produce 64-bit binaries.

Can you send me a link to learn how to compile it as 64bit on the terminal?
http://msdn.microsoft.com/en-us/library/h2k70f3s.aspx

Essentially: vcvarsall.bat x86_amd64
It works. Thanks keskiverto.
Topic archived. No new replies allowed.