1

I would like to be able to see the contents of dynamically allocated array while debugging in Visual Studio 2010. One can easily watch what's inside the statically allocated array but when it comes to dynamical allocation only the address of first element can be seen in debug mode.

Is there an option to preview these contents ? (other than making an array with constant size and assigning all dynamical allocated contents to it)

2 Answers 2

3

It is quite simple, F.e. you have:

char* ptr = new char[10];

Then if you write in debugger:

ptr,10

it will show you content as if it were static array.

Sign up to request clarification or add additional context in comments.

2 Comments

That can be useful but how can I write in debugger ? I just use locals and watch windows.
You can type stuff into the watch window. Or you can use the quickwatch window.
2

You can use memory view window during debug (menu debug->windows->memory->...). Type "ptr" (without quotes) there and you will see actual memory image. While you step in debugger every change occured to the memory will be marked in red.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.