Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Memory Profiler: a way to report difference on # of allocated objects of certain type between snaps

Discussion in 'Profiler Previews' started by jvaarala, Aug 16, 2019.

  1. jvaarala

    jvaarala

    Joined:
    Oct 1, 2016
    Posts:
    4
    We have our own memory profiler tool written in python that imports the snapshots and then crawls the GC heap, builds a dependency graph of allocations (so that you can traverse dependency hierarchies to GC roots along the dependency chain), and finally allows you to diff memory dumps in various ways.

    I was hoping that the Memory Profiler could replace this, so that I don't have to be maintaining this tool going forward. In order for it to work well for our workflow, some things seem to be missing (or maybe I just don't know how to get them out of the tool?):

    1) display stats counts on types of allocated objects between dumps...

    say ... +10 HaxorRoxor.SwissArmyKnife objects
    -100 System.String objects

    this for me is the number one step in starting to find memory leaks

    2) be able to traverse from object to it's root via the full dependency chain

    Is there a way to do this in the existing tool somehow or is there a plan to support such features in the future?

    Cheers,
    Jani
     
    tigerleapgorge likes this.
  2. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,455
    Hello,

    1) Right now, we don't exactly have such a display yet. What you can do is, open two snapshots, press the diff button, in the "Diff All Objects" view, click the header of the column "Type" and select "Group", then do the same with the "Diff" Column. You can expand grouped types to see what changed. Screen Shot 2019-08-27 at 17.49.55.png
    I do admit, that that is not an ideal way to display it. We do have some plans to improve the diff view and I'll add a point in there to improve the way grouped data is summed up/displayed.

    2) Do you want to do the traversal in the UI or through code? For the former, as answered here, we do want add a "Path(s) to Root" Display, yes.
     
    tigerleapgorge likes this.