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. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Official Memory Profiler 1.0.0-pre.3 Released

Discussion in 'Profiler Previews' started by alexeyzakharov, Jul 21, 2022.

  1. alexeyzakharov

    alexeyzakharov

    Unity Technologies

    Joined:
    Jul 2, 2014
    Posts:
    454
    Hi all :)
    We have released version 1.0.0-pre.3 of the Memory Profiler package. See below for details of what’s new.

    What’s New
    All of Memory Comparison
    We have added the ability to compare the All Of Memory tables between two memory captures with the All Of Memory Comparison view. This view allows you to see which items in the All Of Memory table have changed between two captures. For example, in the screenshot below, we can see that the reserved native memory has decreased by 50.2 MB between these two captures.




    The user experience and design is almost identical to the existing Unity Objects Comparison view, allowing you to optionally show unchanged items, as well as showing the relevant objects in each snapshot in the Base and Compared tables below, so they can be inspected in the Details View.




    Opening Snapshot improvements
    Based on the feedback you’ve shared we changed the single click behavior on the Snapshot panel:

    • Single click no longer closes a snapshot - it only opens it.

    • Added a Close button on the open snapshot to close it.
    We hope this will prevent accidental snapshot closing and workflow disruption.

    What’s Next
    We are focusing on stabilization of Memory Profiler and releasing the final 1.0.0 version in the coming months.

    We would like to hear from you
    We want to learn about your experience on using this Memory Profiler package.


    Whether you have used the package before or not, we would love to get your input via this survey which is designed to take 30-60 minutes of your time.


    As always, we value your feedback and ask that you provide your candid and honest opinion.


    Let’s build the tool together.
    Thank you.
     
  2. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    732
    Hiya, i was just checking the API, and i noticed it allows me to take snapshots.

    However i was wondering if there are plans to allow me to, in code, also get information from the snapshots? What my goal was is something like a reference finder, i wanted a list of everything that references this particular Component.

    I know the Memory profiler already does this, but just wanted my own window for it.
     
    alexeyzakharov likes this.
  3. alexeyzakharov

    alexeyzakharov

    Unity Technologies

    Joined:
    Jul 2, 2014
    Posts:
    454
    Thanks for the question @TJHeuvel-net ! We have the idea of providing public api for reading the data on our backlog, but atm we don't plan it for development. If you think this is something we should be focusing on, please help us with prioritization and participate in the survey :)
     
  4. MaxEdOwlcat

    MaxEdOwlcat

    Joined:
    Nov 26, 2019
    Posts:
    7
    Alexey, thank you and the team for the new profiler, it's much easier and faster to use than the old one, and it also seems to show memory differences between snapshots more precisely (the old version was prone to lying about objects' status (New/Deleted/Same)). However, I'm missing the ability to filter objects by status in All Memory comparison window. This is very useful when searching for memory leaks, so is it possible to bring back the ability to filter by New/Deleted/Same in the next versions?

    Also, the references window, while very useful, can use some improvements still. One of the biggest problems when looking for a stuck reference is filtering out all the circular references, which remains alive along with the object (e.g. A -> B -> A). If possible, I'd like to see nodes marked clearly as root nodes - this should allow one to distinguish a "true" holding reference from a harmless circular one, because it ends in a root. Additionally, it would be great if circular links were clearly marked as such, though I can see how it could be hard to implement (links of type A -> B -> C -> B). One approach, I guess, is to mark as circular any node that appears in the tree twice. Since the tree is not constructed all at once, but only when the user expands a node, it makes sense to mark node as circular if we have already seen it before.

    As a cherry on the top, I'd like to see a way to export data from the profiler to CSV and maybe other relevant formats, because it makes it easier to write case-specific tools. E.g. some times I'd like to export the references tree and search it textually for some classes I suspect of being the source of the leak.
     
    alexeyzakharov likes this.
  5. alexeyzakharov

    alexeyzakharov

    Unity Technologies

    Joined:
    Jul 2, 2014
    Posts:
    454
    Thank you for the kind feedback @MaxEdOwlcat !

    This is a great suggestion! We've spend some time exploring the solution for the problem you've described (we called it "root references view") for the 1.0 release. And paused (at least for now) the development due to same challenges - performance and what to treat as a root in cyclic cases. The managed references are essentially a directed cyclic graph which is quite slow to traverse and if it is not fully traversed - there is a question what should be treated as a root (you can grab any node in cyclic graph and declare it as a root, but that is not very actionable). So we've decided to get back to the problem once we have better ideas and your post gives us such ideas and knowledge that this is a valuable addition! (Added the feedback to the backlog)

    Thank you for asking for the export functionality - we've added your request to the backlog. That helps us to give more weight for the feature prioritization!
     
  6. alexeyzakharov

    alexeyzakharov

    Unity Technologies

    Joined:
    Jul 2, 2014
    Posts:
    454
    we would like to understand the usecase better here. Our expectation was that the new diff workflow should have superseded the New/Old/Delete grouping.

    Do you miss the ability to group the flatten list of individual objects?

    For more context - by default we are not showing the "Same" objects (Show Unchanged toggle shows or hides those). And the Count Diff column reflects the New/Delete objects of the same Type+Name. Sorting by Count Diff column would naturally allow understanding New/Delete objects within a set of objects of the same type and name.
    Unity_2022-10-11_09-52-00.png
     
  7. MaxEdOwlcat

    MaxEdOwlcat

    Joined:
    Nov 26, 2019
    Posts:
    7
    Hi Alexey,

    The problem we have is with the bottom pane on that screenshot - as far as I understand, it shows both same and new objects (at least for All of Memory view, though I think it's the same behaviour in both main views), and there is no way to determine which is which. Here's the example from our snapshot:

    upload_2022-10-12_12-2-6.png

    Some of those objects remained from the Base snapshot (I can check that, because they are referenced by the same objects - for which I can see addresses in the Reference Tree panel), and some are new. But there is no easy way to see which is which.

    > The managed references are essentially a directed cyclic graph which is quite slow to traverse and if it is not
    > fully traversed - there is a question what should be treated as a root (you can grab any node in cyclic graph
    > and declare it as a root, but that is not very actionable)

    As far as I know, cyclic references do not actually prevent the object from being GC'ed, you actually need a defined root object somewhere?
     
    alexeyzakharov likes this.