Fully featured low overhead profiler for Java EE and Java SE platforms.
Ultimate profiling and monitoring solution for Gradle, Maven, Ant, JUnit and TestNG.
Easy to use performance and memory profiler for .NET framework.

API to walk allocation tree?

Moderators: Vladimir Kondratyev, Anton Katilin

API to walk allocation tree?

Postby mitch » Mon Aug 03, 2015 5:28 pm

I'd like to examine a snapshot via API, walking around on call tree vs allocations. There's a view to do this in the UI, if you look at Memory + Class and Package + Allocations tabs.

I have the MemorySnapshot API working well on my snapshots, including using set description language to query known class trees. It's clear that you can use getShallowSize() and getObjectCount() to answer a specific question about what memory is linked where. But it's not clear how to use MemorySnapshot to examine which call path has performed an allocation, only where the memory sits after it got created.

What am I missing? Is there more example material reading snapshots than sample 2 in the distribution?
mitch
 
Posts: 2
Joined: Mon Aug 03, 2015 4:55 pm

Re: API to walk allocation tree?

Postby Anton Katilin » Mon Aug 03, 2015 8:07 pm

There is no API for that, please use the profiler UI to find where particular objects were allocated. Also I can suggest to consider the "Export with command line tool" functionality to get object allocation statistics:
https://www.yourkit.com/docs/java/help/export.jsp

Anyway, the API is intended to perform tasks automatically, on regular basis. What is your task? What kind of analysis would you perform?
Anton Katilin
 
Posts: 5575
Joined: Wed Aug 11, 2004 8:37 am

Re: API to walk allocation tree?

Postby mitch » Mon Aug 03, 2015 8:26 pm

Okay, I'll play some more with the command line exporter.

My task is roughly: "which objects were allocated from which call stacks?" The objects are not among the retained size from those call stacks; they're side effects and get stored in other pools.

So I kind of expected an iterator of some kind to walk around in the snapshot, which would look a lot like getShallowSize() or getObjectCount(). It would take a selection XML like those and for each element, hand you some kind of tuple roughly
Code: Select all
 { String full_object_class, List<String> allocation_call_stack, long size, etc }
.

A user's traversal could then examine every object in the snapshot via reflection, which you can't do now. You can only count them and size them, but you have to provide each name of each thing one at a time.
mitch
 
Posts: 2
Joined: Mon Aug 03, 2015 4:55 pm

Re: API to walk allocation tree?

Postby Anton Katilin » Tue Aug 04, 2015 8:48 am

My task is roughly: "which objects were allocated from which call stacks?" The objects are not among the retained size from those call stacks; they're side effects and get stored in other pools.

Please note that the profiler UI provides a powerful set of views to comprehensively solve this task:
https://www.yourkit.com/docs/java/help/ ... _alloc.jsp
Anton Katilin
 
Posts: 5575
Joined: Wed Aug 11, 2004 8:37 am


Return to Java Profiler

Who is online

Users browsing this forum: Bing [Bot] and 6 guests