Is it possible to see contents of stack and heap after every line of execution. I want to see it as it will give clear idea about memory allocation and deallocation in .Net. With your
If any document or link which will clear my doubts with your answer please share.
SOS or PssCor are a good place to start, along side WinDbg.
Once you've got that sorted out; attach WinDbg to your process, the load the debugger extension. For example:
.load C:\pathtoextensions\psscor4.dll
After that, you can issue the !dumpheap
or !dumpstack
commands.
The output of both of these commands is very raw. !dumpheap -stat
will give you a "statistical" overview of your heap. The type, the number allocated, and the bytes in total for all allocations.
This isn't a super straightforward task. It'll take a while to get enough practice with WinDbg if you haven't used it before.
What you can do is set a breakpoint on a method using !bpmd
, and use the commands mentioned above, then step over using the p
command, and re-run the commands.
I'm sure there are other commercial tools like ANTS Profiler or dotTrace that may get the job done - but I don't have a lot of experience with either tool.
Once you've gotten started, you can ask (new) more specific questions about SOS or Psscor.