I cannot allocate memory for my 1D array in c++. I tried using malloc and new operator. merge
has value 0 when I use malloc. In case of new operator I obtain exception std::bad_alloc at memory location ...
. data_length
has value of 131596814. I have got 8GB ram and plenty of it is free. I am using Visual Studio 2012 and Debug/Release mode doesn't affect it.
unsigned int* merge = (unsigned int*) malloc(2 * data_length * sizeof(unsigned int));
unsigned int* merge = new unsigned int[data_length * 2];
Am I doing something wrong here?