I have following C++ node
unsigned int uiNoOfItems = 113;
unsigned int W = 2347;
// create two dimensional array
unsigned int ** optimalWeight = new unsigned int* [uiNoOfItems + 1];
for (unsigned int uiRowIdx = 0; uiRowIdx <= uiNoOfItems; uiRowIdx++) {
optimalWeight[uiRowIdx] = new unsigned int (W + 1);
}
std::cout << " initializing first column "<< std::endl;
// initialize first column
for (unsigned int uiRowIdx = 0; uiRowIdx <= uiNoOfItems; uiRowIdx++) {
optimalWeight[uiRowIdx][0] = 0;
}
std::cout << " initializing first row "<< std::endl;
// initialize first row
for (unsigned int uiColIdx = 0; uiColIdx <= W; uiColIdx++) {
// std::cout << uiColIdx << std::endl;
optimalWeight[0][uiColIdx] = 0; ------------------------> crash happens here at uiColIdx value 1210
}
Above code crash is happening at mentioned line. I am not getting why as memory allocation is successfull.