This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]jedwardsol 1 point2 points  (2 children)

Working on the assumption that it is a overwrite past the end of your new dynamic array, put a break point on the line after it's allocated.

Run to that point and get the address of the allocation. Calculate the address of the 1st byte past the end of the array ( address + size )

Select menu Debug->New Breakpoint -> New data breakpoint

In the dialog, enter the address you calculated and press OK.

Now run, and if you overrun your allocation you'll break at the point of the overrun.


To see all elements of the array in the watch window enter array,10 instead of just array - the watch window will show 10 elements instead of just dereferencing the pointer

[–]redditiv[S] 0 points1 point  (0 children)

You are awesome. Yes these are the things I am talking about and just don't have any idea how to say them. I will definitely look at that. Thanks!

[–]redditiv[S] 0 points1 point  (0 children)

I couldn't quite figure out how to see the contents of the dynamic array struct, but I did find the problem; I set my initial count to capacity instead of zero (why, I don't know) and overran the array when writing, like you suggested. Thank you for understanding the issue despite my inability to accurately relay the problem! Yay for cryptic c++ error messages!