Is your heap corruption caused by a custom-made class with an array built in? The following would be an example:
class MyClass
{
private:
public:
int* my_array = new int[10];
~MyClass()
{
delete [] my_array;
}
// possibly other stuff
};
If so, one can simplify the problem for debugging purposes by changing int* my_array = new int[10];
into something more like my_array[10];
, then running that through debugging software. This reduces the issue to a segmentation fault rather than heap corruption, which is simpler territory to contend with. With a segmentation fault, it is easier to check if the numbers for memory sections line up.
Note: with a simple C-style array, the delete [] in the example above should be erased or commented out.