Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.

    Read our full announcement for more information and let us know if you have any questions.

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.