I'm not sure what the maximum value that you can use as a subscript for an array in C++ is, but if the numRows and numCols varaibles aren't initialised, you may be trying to allocate a negative value (if you've overflowed the subscript type). I'll see how many bits your subscript can be.
*Edit - it appears the general consensus is that your system's size_t limit is the limit for array subscripts.
Try printing out the product of numRows*numCols so you can actually see what you're trying to allocate.
numRows*numCols = 3 when program crashes. But before I look into that problem I really want to figure out why I'm not catching the exception when running the program but do catch the exception when running it using the debugger (Codeblocks debugger).
Ok solved the bad_alloc problem. I was passing a pointer to an array whose dimensions were smaller than the function believed. So the function was accessing memory outside the bounds and writing doubles. Not sure why this lead to bad_alloc later in the program... I'll also assume it was stuffing up the exception throw/catch.