Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    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


    Oct 1, 2016
    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?

    tigerleapgorge likes this.
  2. MartinTilo


    Unity Technologies

    Aug 16, 2017

    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.