Which thread is using a given object?

  1. I run dumpheap -type MyObjectType command to get the method table for MyObjectType. It shows three object on heap.
  2. I run dumpheap -mt <method table address> to get address.
  3. I run !gcroot <address> command to find the references to these objects, find nothing
  4. !do <address> and it provides details about fields for this object etc.

How can I find which thread is referencing or using object? Any command to find that out?


There's no easy way to do this, but you could run !dso for each thread (i.e. ~*!dso). That will tell you which objects each of the threads reference. To help navigate the output I usually log it to a file and use grep or a decent text editor to search the results.

Need Your Help

Read and write file outside Jar

java io

I am making my first executable crossplatform jar file from a bunch of java files that I have. Problem is, I need to read in some values from a txt file just outside my file. This was working well

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.