How can I check how many instances of a class got created during recording of object allocation in YourKit?

StackOverflow https://stackoverflow.com/questions/17919215

Question

I am new to YourKit profiler and after reading some good reviews wanted to give it a try . I am trying to profile a webapp running in weblogic application server. I basically want to check how many instances of a particular class got created between the time I start recording and the time when I stopped recording object allocation. How can I do that? I would also like to know the stacktrace for those object creation methods. For doing this do I also have to capture memory snapshot after starting allocation recording? If yes, then why?

Was it helpful?

Solution

I basically want to check how many instances of a particular class got created between the time I start recording and the time when I stopped recording object allocation. How can I do that?

Find the number recorded, e.g. search for the class under allocations. If you recorded every 10th allocation, multiply this by ten to get an estimate of the number. If you need to exact number you need to record every instance created (this will slow your application)

I would also like to know the stacktrace for those object creation methods.

You can get a summary of these stack trace by look at where these allocations occurred.

For doing this do I also have to capture memory snapshot after starting allocation recording?

I doubt this is supported out of the box as taking a snapshot is very, very expensive. However YourKit provides an API and you could trigger a snapshot programatically each time this object is created by adding this to the constructor of the object you want to trace.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top