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?
Registered users can post here. Sign in or register to post.