0

I'm curios is there any tool in visual studio 2015 to monitor run-time created objects?

For example in this example:

Car c = new Car();
c = new Car("black");

I want to see myself does two new keywords for single object creates two instances of a class while first one is inaccessible and just used memory? (In this case I guess answer is yes)

Also this tool can be very useful while working with com objects, because when you work with com objects in some cases if you don't write code properly some objects creat automatically while programmer is not aware of them and don't dispose at all, which is really difficult to find out how many unwanted objects exist and where they come from.

I investigated Diagnostic Tools in visual studio 2015. In Event tab I haven't find anythings useful, it seems it just provides a volume of information about execution time. What is more, Memory Usage tab is empty and doesn't show any things.

Also most of my searches in google directed me to Quick Watch or Immediate Window which is not relevant to what I'm looking for.

Masoud Keshavarz
  • 2,166
  • 9
  • 36
  • 48
  • But the first c-instance will be overriden, right? – kame Jan 06 '18 at 08:16
  • You should be able to do this with WinDbg [here is a basic intro](https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/debugging-managed-code) and [here is an SO post](https://stackoverflow.com/q/26645893/416574) that should be a help in showing how to dump the heap and examine it, and [this is another](https://stackoverflow.com/q/25247149/416574) SO post that may prove helpful. – pstrjds Jan 06 '18 at 08:24
  • @pstrjds Thanks, I will check it out – Masoud Keshavarz Jan 06 '18 at 08:41
  • @masoudkeshavarz - Forgot to post [this link](https://dlaa.me/blog/post/9471347) also. It is an older blog post but it walks through an example of how to see what references are keeping objects alive in the GC. – pstrjds Jan 06 '18 at 09:51

0 Answers0