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. The 2023.1 beta is now available for testing. To find out what's new, have a look at our 2023.1 feature highlights.
    Dismiss Notice

Official Memory Profiler 1.0.0-pre.2 Released

Discussion in 'Profiler Previews' started by AndyBarnard, Jun 21, 2022.

  1. AndyBarnard

    AndyBarnard

    Unity Technologies

    Joined:
    Nov 12, 2019
    Posts:
    8
    Hi all :)

    We have released version 1.0.0-pre.2 of the Memory Profiler package. See below for details of what’s new.

    What’s New

    Tab Restructure

    Unity Objects and All Of Memory Tabs
    The Unity Objects and All Of Memory views have been promoted to their own tabs within the interface. These two views were previously located under a single ‘Breakdowns’ tab.

    Potential Duplicates
    The Potential Duplicates view has been moved to a toggle option within the Unity Objects view.

    Removal Of Experimental Tabs
    As outlined in a previous 0.6 release forum post, we have made the difficult decision to remove the experimental ‘Fragmentation’ and ‘Objects & Allocations’ tabs from the package. We have done extensive user testing and interviews over the past year and heard your feedback that these views can be difficult to use, unclear for many users, and often require expert domain knowledge to know what to look for. In addition, the experimental ‘Tree Map’ tab is also being removed due to architectural and performance issues and may be superseded in a future release by breakdown-specific tree map visualizations if there is sufficient demand for it.

    We wish to make optimizing memory a task that is accessible to a wide range of our diverse user base. Achieving this requires better direction to potential memory issues, as well as guidance to solutions through clear user experience and high quality tooling. We believe that the simplified tab structure represents a better starting point for our ambitions for the Memory Profiler going forward.

    As a result, there are now three tabs when in Single mode – ‘Summary’, ‘Unity Objects’, and ‘All Of Memory’ – and currently two tabs when in Comparison mode – ‘Summary’ and ‘Unity Objects Comparison’.

    Tab Restructure.png

    If you have a workflow that requires one of the removed tabs, firstly please tell us because we want to hear about it! You can use the Unity Engineering Roadmap to make an official feature request, or alternatively you can contact some of the team here on the forums. And secondly, you can install the last experimental release that includes the experimental tabs, 0.7.1-preview.1, by adding the following line to your package manifest file’s dependencies:

    "com.unity.memoryprofiler": "0.7.1-preview.1"


    Total Memory Reporting & Summary View

    Memory reporting has been reworked to offer a clearer picture of your memory footprint by being much closer to how many operating systems work with memory. This gives you more clarity over how your application is consuming the memory resources of the target device.

    This new approach is visible in the redesigned and rebuilt Summary view, as discussed below.

    Summary.png

    Memory Usage On Device
    This section displays how much resident memory your application is using and its relative contribution to the total physical memory available on the target device. Resident memory is your application’s memory footprint in the device’s physical memory. It affects your application’s performance and stability, as using too much physical memory may cause memory swapping on platforms where swap memory is available, or even eviction of your application if its memory footprint becomes too high. This new section therefore gives you greater clarity over these potential memory issues.

    Memory Usage On Device.png

    Please note that the Memory Usage On Device section is only available for memory captures taken on 2022.1 and later.

    Total Committed Memory
    The Total Committed Memory section shows the size of your application’s committed memory and how it breaks down across high level categories, such as Native, Managed, and Graphics. Committed memory includes all the memory that was allocated by your application, whether it is resident in physical memory, swapped out to disk, or mapped to a file. Here you can get an overview of how your application’s memory is distributed across these high level categories.

    Total Committed Memory.png

    Managed Memory
    The Managed Memory section contains the same information as before, with some subtle UI tweaks and a link to inspect managed memory in the All Of Memory view.

    Top Unity Object Categories
    The new Top Unity Object Categories section shows you which categories of Unity Objects are the biggest contributors to your application’s committed memory, alongside a link to the Unity Objects view to inspect further. Some examples of Unity Object Categories are Texture2D, Shader, and AudioClip. Being able to see the largest Unity Object Categories at a glance can be helpful for getting a brief high-level understanding of how your application is using core Unity Engine objects, as well as quickly spotting an unexpected outlier, such as a category being larger than expected.

    Top Unity Object Categories.png

    Unity Objects Comparison

    Building on the Unity Objects work introduced prior, we have now added the ability to compare the Unity Objects between two memory captures.


    The Unity Objects Comparison view compares the Unity Objects between two memory captures and shows you the differences between them. Firstly, this allows you to quickly see which Unity Object Types, such as Texture2D or Material, have changed in their size or their count between the two captures.


    Expanding a Unity Object Type shows you all the Unity Objects of that type that changed between the two captures. This allows you to determine which Unity Objects contribute to the change and by how much. When there are multiple Unity Objects with the same name, they are grouped into a single entry in the list.


    Selecting one of these Unity Object groups will display the Unity Objects present in each capture in the two tables below. This allows you to investigate the details of each Unity Object present in both captures using the Details View, as shown below.


    Becoming Verified

    As you might have noticed from the version number, 1.0.0-pre.2, this version marks our first step towards reaching a verified ‘1.0’ status for the Memory Profiler package. The team has worked hard to reach the high standard of quality required for us to feel comfortable to move the Memory Profiler from an experimental status to becoming a fully verified package in Unity 2022.

    We still anticipate some additional 1.0 pre releases (...pre.3 etc.) prior to the final release in the 2022 cycle.

    Unity 2022

    This also means that the Memory Profiler 1.0 will now become a 2022 package, requiring Unity 2022 or later.

    To view snapshots taken in projects running on earlier Editor versions, such as 2019 LTS, 2020 LTS, or 2021 LTS, you can open the Memory Profiler in a 2022 Unity Editor and open your snapshots using the Import Snapshot functionality.

    What’s Next

    The team is currently working on:
    • All Of Memory Comparison.
    • Bug fixes, minor UX adjustments, and stabilization.

    Feedback

    Please submit feature requests and feedback to the Unity Engineering Roadmap. Alternatively, you can contact some of the team here on the forums.
     
  2. Jes28

    Jes28

    Joined:
    Sep 3, 2012
    Posts:
    969
    Hi
    Thanks for sharing

    Can you explain please this difference:
    one place say that app use 0.5GB but another that app use more than 2

    upload_2022-6-21_15-29-53.png
     
  3. AndyBarnard

    AndyBarnard

    Unity Technologies

    Joined:
    Nov 12, 2019
    Posts:
    8
    Hi @Jes28.

    In that screenshot, the figure of 0.55 GB is Resident memory and the figure or 2.14 GB is Committed memory.

    Resident memory is your application’s memory footprint in the device’s physical memory, displayed as a proportion of the available physical memory (3.52 GB in the screenshot). Committed memory however, includes all of the memory that was allocated by your application, whether it is resident in physical memory, swapped out to disk, or mapped to a file.

    So, whilst committed memory gives you a complete picture of all of your application's allocated memory, regardless of where it currently resides, resident memory shows you how your application's memory is interacting with the operating system – specifically how much of it currently resides in the device's physical memory. This is important because high resident memory footprint can affect your application’s performance and stability. Using "too much physical memory may cause memory swapping on platforms where swap memory is available, or even eviction of your application if its memory footprint becomes too high".

    -andy.
     
    Havokki, mahdi_jeddi and Jes28 like this.
  4. antonk-unity

    antonk-unity

    Unity Technologies

    Joined:
    Oct 4, 2016
    Posts:
    39
    I've made a diagram that might help explain how different memories are related. Or might confuse you even more :)

    upload_2022-6-22_11-59-31.png

    PS: Compressed/Swap memory on Android is vendor specific. It might be Linux zRAM or like Samsung "RAM Plus" which is an outright swap file.
     
  5. Jes28

    Jes28

    Joined:
    Sep 3, 2012
    Posts:
    969
    Good diagram! :)
    Add it to profiler window
     
    Tetsuya_OYA and AndyBarnard like this.