Skip to content

Commit 472f2a0

Browse files
author
Unity Technologies
committed
## [1.1.1] - 2024-09-10 ### Added - Added the name of the assembly to the Type details when selecting a Managed Type group. ### Fixed - Fixed navigating with arrow keys not updating reference list in All of Memory view ([PROFB-153](https://issuetracker.unity3d.com/product/unity/issues/guid/PROFB-153)). - Fixed retention of Snapshot list expansion and scroll state so that it does not expand all items unexpectedly but remembers which sessions were collapsed and which extended ([PROFB-196](https://issuetracker.unity3d.com/product/unity/issues/guid/PROFB-196)). - Fixed dropdown text being clipped when "Allocated and Resident Memory on Device" was selected. - Fixed an issue whereby graphics allocations not associated with a native object would display under a "No Name" category in the All of Memory table. - Fixed issues with selecting array objects, or objects that had managed fields with arrays, when the arrays where multidimensional with one or more dimensions of size 0. - Fixed exception when opening the Unity Objects table in Comparison mode when there are multiple MonoBehaviour or ScriptableObject types with the same name but from different assemblies. - Fixed exception when opening the All Of Memory table in Comparison mode when either of the snapshots is from a pre 2022.2 runtime and the untracked amount is negative. - Fixed an ArgumentOutOfRangeException when inspecting some Managed Objects ([PROFB-223](https://issuetracker.unity3d.com/product/unity/issues/guid/PROFB-223)). - Fixed longer string values not being displayed in the Managed Fields Inspector. - Fixed an issue that caused IL2CPP VM memory to not be calculated correctly in the Summary and All Of Memory table. - Remove deprecated UxmlFactory/UxmlTraits API usage on Unity 6. - Add divider on "Capture" toolbar button dropdown. - Reattributed IL2CPP VM memory from Native to Managed in the All Of Memory table. ### Changed - Allowed Snapshots to reside in Subfolders within the configured memory snapshot path. - Improved Snapshots folder monitoring: Changes to the folder are now reflected in the Editor without it requiring to acquire focus first. - Improved display of managed arrays in the Selected Item Details and Managed Fields.
1 parent dade520 commit 472f2a0

File tree

153 files changed

+7409
-546
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+7409
-546
lines changed

.signature

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"timestamp":1725974903,"signature":"FUsr9InlCwm0zSc51YKx5VR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ZKS1IvU2l5eEN1Q20vQWJkYnJMbXk0WjlSdm1jMGdpclA4T0lLQWxBRWZ2TzV5Z2hSKy8vd1RpTFlzUQp1SllDM0V2UE16ZGdKUzdGR2FscnFLZzlPTCsxVzROY05yNWdveVdSUUJ0cktKaWlTZEJVWmVxb0RvSUY5NHpCCndGbzJJT1JFdXFqcU51M3diMWZIM3p1dGdtalFra3IxVjJhd3hmcExLWlROQWdNQkFBRT0KLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg"}

CHANGELOG.md

+27
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,34 @@ All notable changes to this package will be documented in this file.
77
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
88
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
99

10+
## [1.1.1] - 2024-09-10
11+
12+
### Added
13+
- Added the name of the assembly to the Type details when selecting a Managed Type group.
14+
15+
### Fixed
16+
- Fixed navigating with arrow keys not updating reference list in All of Memory view ([PROFB-153](https://issuetracker.unity3d.com/product/unity/issues/guid/PROFB-153)).
17+
- Fixed retention of Snapshot list expansion and scroll state so that it does not expand all items unexpectedly but remembers which sessions were collapsed and which extended ([PROFB-196](https://issuetracker.unity3d.com/product/unity/issues/guid/PROFB-196)).
18+
- Fixed dropdown text being clipped when "Allocated and Resident Memory on Device" was selected.
19+
- Fixed an issue whereby graphics allocations not associated with a native object would display under a "No Name" category in the All of Memory table.
20+
- Fixed issues with selecting array objects, or objects that had managed fields with arrays, when the arrays where multidimensional with one or more dimensions of size 0.
21+
- Fixed exception when opening the Unity Objects table in Comparison mode when there are multiple MonoBehaviour or ScriptableObject types with the same name but from different assemblies.
22+
- Fixed exception when opening the All Of Memory table in Comparison mode when either of the snapshots is from a pre 2022.2 runtime and the untracked amount is negative.
23+
- Fixed an ArgumentOutOfRangeException when inspecting some Managed Objects ([PROFB-223](https://issuetracker.unity3d.com/product/unity/issues/guid/PROFB-223)).
24+
- Fixed longer string values not being displayed in the Managed Fields Inspector.
25+
- Fixed an issue that caused IL2CPP VM memory to not be calculated correctly in the Summary and All Of Memory table.
26+
- Remove deprecated UxmlFactory/UxmlTraits API usage on Unity 6.
27+
- Add divider on "Capture" toolbar button dropdown.
28+
- Reattributed IL2CPP VM memory from Native to Managed in the All Of Memory table.
29+
30+
### Changed
31+
- Allowed Snapshots to reside in Subfolders within the configured memory snapshot path.
32+
- Improved Snapshots folder monitoring: Changes to the folder are now reflected in the Editor without it requiring to acquire focus first.
33+
- Improved display of managed arrays in the Selected Item Details and Managed Fields.
34+
1035
## [1.1.0] - 2023-10-16
36+
37+
### Changed
1138
- Bump version to 1.1.0 from 1.1.0-pre.3.
1239

1340
## [1.1.0-pre.3] - 2023-09-27

Documentation~/all-memory-tab.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The __All Of Memory__ tab splits tracked memory into four different top-level ca
1111

1212
|__Category__|__Description__|
1313
|:---|:---|
14-
|__Managed__| Displays all Virtual Machine and Managed Heap memory allocations. The Managed Heap contains data related to __Managed Objects__ and the space that has been reserved for them. It is managed by the Scripting Garbage Collector, so that any managed objects that no longer have references chain to a root are collected. The 'reserved' amount in this category may be quickly reused if needed, or it will be returned to the system every 6th GC.Collect sweep. Check [Managed memory](https://docs.unity3d.com/Manual/performance-managed-memory.html) documentation page for more details.|
14+
|__Managed__| Displays all Virtual Machine and Managed Heap memory allocations. The Managed Heap contains data related to __Managed Objects__ and the space that has been reserved for them. It is managed by the Scripting Garbage Collector, so that any managed objects that no longer have a references chain to a root are collected. The 'reserved' amount in this category may be quickly reused if needed and if any new allocations fit within one of the free spaces. Check [Managed memory](https://docs.unity3d.com/Manual/performance-managed-memory.html) documentation page for more details. |
1515
|__Native__| Displays all memory that Unity allocated internally for different native objects, such Scene Objects (Game Objects and their Components), Assets and Managers, Native Allocations including Native Arrays and other Native Containers, CPU side of Graphics Asset memory, and other. This doesn't include Graphics, which is shown in a separate category. Expand this group to see the different kinds of native memory that Unity tracks.</br></br>The __Unity Objects__ subgroup displays memory that any Unity object in your application, such as a Shader or Texture2D, uses. Use this information to find areas where you could optimize memory use; you can then find these objects in the [Unity Objects tab](unity-objects-tab.md) to inspect them in more detail.</br></br>The __Unity Subsystems__ subgroup displays memory that installed modules or systems use. You can find which modules use the most memory and, if any aren't used, uninstall them to reduce how much memory your application needs.|
1616
|__Executables & Mapped__| Displays the memory taken up by the build code of the application, including all shared libraries and assemblies, managed and native. This value is not yet reported consistently on all platforms. You can reduce this memory usage by using a higher code stripping level and by reducing your dependencies on different modules and libraries.|
1717
|__Graphics (Estimated)__| Displays how much memory is used by the Graphics Driver and the GPU to visualize your application. The information is based on the tracking of graphics resource allocations within Unity. This includes RenderTextures, Textures, Meshes, Animations and other graphics buffers which are allocated by Unity or Scripting API. Use All Of Memory tab to explore graphics resources. Not all these objects' memory is represented in this category. For example, Read/Write enabled graphics assets need to retain a copy in CPU-accessible memory, which doubles their total memory usage. Use Unity Objects tab to explore total memory usage of Unity Objects. Also, not necessarily all memory from these type of objects resides in GPU memory. Memory Profiler is unable to get exact residence information for graphics resources.|

Documentation~/filter.yml

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
apiRules:
2+
- exclude:
3+
hasAttribute:
4+
uid: System.ComponentModel.EditorBrowsableAttribute
5+
ctorArguments:
6+
- System.ComponentModel.EditorBrowsableState.Never
27
- exclude:
38
# inherited Object methods
49
uidRegex: ^System\.Object\..*$
@@ -27,13 +32,19 @@ apiRules:
2732
uidRegex: ^$
2833
type: Namespace
2934
- exclude:
30-
uidRegex: test$
35+
uidRegex: ^.*test$
36+
type: Namespace
37+
- exclude:
38+
uidRegex: ^.*Tests$
39+
type: Namespace
40+
- exclude:
41+
uidRegex: ^.*Tests\.*$
3142
type: Namespace
3243
- exclude:
33-
uidRegex: Tests
44+
uidRegex: ^.*\.Tests.*$
3445
type: Namespace
3546
- exclude:
36-
uidRegex: \.Testing
47+
uidRegex: ^.*\.Testing.*$
3748
type: Namespace
3849
- exclude:
3950
uidRegex: \.Dispose$

Documentation~/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ When you install the Memory Profiler package, Unity automatically installs the [
3434

3535
The memory snapshots you take with the Memory Profiler UI or the [Memory Profiler API](https://docs.unity3d.com/Documentation/ScriptReference/Profiling.Memory.Experimental.MemoryProfiler.html) contain the entire contents of the managed heap of the Player or Editor instance you are capturing.
3636

37-
You can see most of the data through the Memory Profiler UI, with the exception of managed allocations that do not have a garbage collection handle. These allocations might be related to Mono type data, leaked managed data, or allocations that the garbage collector has already collected and released but the memory section they were located in hasn’t been overwritten with new data. The latter happens because garbage-collected memory is not "stomped" for performance reasons.
37+
You can see most of the data through the Memory Profiler UI, with the exception of managed allocations that do not have a garbage collection handle. These allocations might be related to Mono type data, or allocations that the garbage collector has already collected and released but the memory section they were located in has not been overwritten with new data yet. The latter happens because garbage-collected memory is not "stomped" for performance reasons.
3838

3939
The kind of data that you can explore in areas such as the __All Managed Objects__ view gives you an idea of what data could be included in the memory snapshot. The Memory profiler includes any object instance of a class, all fields on that object, as well as the class’ statics excluding literals such as const values.
4040

Documentation~/summary-tab.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The following table describes the sections available in this tab:
1212
|__Tips__| Displays any contextual warnings or additional useful information about the snapshots, such as potential issues with your snapshot and insight about how to understand an Editor capture.|
1313
|__Memory Usage On Device__| The application footprint in physical memory. It includes all Unity and non-Unity allocations resident in memory at the time of the capture.|
1414
|__Allocated Memory Distribution__| Displays how your allocated memory is distributed across different memory categories.|
15-
|__Managed Heap Utilization__| Displays a breakdown of the memory that Unity manages which you can't affect, such as memory in the managed heap, memory used by a virtual machine, or any empty memory pre-allocated for similar purposes.|
15+
|__Managed Heap Utilization__| Displays a breakdown of the memory that Unity's Scripting VM manages, which includes managed heap memory used for Managed Objects, Empty Heap Space that might've previously been used by Objects or been reserved during the last heap expansion, and memory used by a virtual machine itself. |
1616
|__Top Unity Objects Categories__| Displays which types of Unity Objects use the most memory in the snapshot.|
1717

1818
Hover over any of the bars in the tab to highlight the corresponding label, and vice versa. Continue hovering your cursor over the bar or label to display how much that element contributes to the total, as a percentage.

Documentation~/whats-new.md

+21-18
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
1-
# What's new in version 1.1.0
1+
# What's new in version 1.1.1
22

3-
Summary of changes in Memory Profiler version 1.1.0 (formerly 1.1.0-pre.3).
3+
Summary of changes in Memory Profiler version 1.1.1.
4+
5+
### Added
6+
- Added the name of the assembly to the Type details when selecting a Managed Type group.
47

58
### Fixed
6-
- Fixed an exception on capturing when the default snapshot storage path was used (./MemoryCaptures) but did not exist. It now gets created if it is missing. Custom set storage paths will still not be created as issues with these need user input to get resolved properly.
7-
- Fixed an ArgumentOutOfRangeException in ManagedObjectInspector on selecting some object entries in the All of Memory and Unity Objects table. The field inspector UI was trying to display the managed field values of static fields that hadn't been initialized.
8-
- Fixed Snapshot opening triggering a synchronous search via SearchService to initialize it for the Select, Find and Asset Preview functionality. As that could trigger SearchService to start indexing, this might have lead to longer stalls on opening snapshots.
9-
- Fixed string rendering when strings included the ´\r´ character ([PROFB-113](https://issuetracker.unity3d.com/product/unity/issues/guid/PROFB-113)).
10-
- Fixed a crash on opening snapshots with very large managed memory usage ([PROFB-156](https://issuetracker.unity3d.com/product/unity/issues/guid/PROFB-156)).
11-
- Fixed messaging for resident memory breakdown data availability. Detailed resident memory breakdown data is available for snapshots taken from Unity versions 2023.1 or newer.
12-
- Fixed the Unity Object and All Of Memory table UI so that the table mode dropdown does not disappear in a narrow window size. ([PROFB-110](https://issuetracker.unity3d.com/product/unity/issues/guid/PROFB-110))
13-
- Disabled resident memory visualization in "Unity Objects" and "All of Memory" tables for WebGL platform. WebGL doesn't provide residency status.
14-
- Fixed bug that detailed information isn't showed for graphics resources.
15-
- Fixed a bug when you can't switch snapshot if snapshot was previously open in compare mode.
16-
- Fixed a managed memory leak in the Memory Profiler Module UI that the package inserts into the Profiler Window ([PROFB-160](https://issuetracker.unity3d.com/product/unity/issues/guid/PROFB-160)). Also reduced the impact of a Mesh memory leak caused by UI TK ([UUM-46520](https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-46520)).
17-
- Fixed the display of the memory usage bar diagrams in the Memory Profiler Module UI that the package inserts into the Profiler Window ([PRFOB-165](https://issuetracker.unity3d.com/product/unity/issues/guid/PROFB-165)).
18-
- Fixed issue with Unity Objects view that caused some managed objects not to group and shown as separate items.
9+
- Fixed navigating with arrow keys not updating reference list in All of Memory view ([PROFB-153](https://issuetracker.unity3d.com/product/unity/issues/guid/PROFB-153)).
10+
- Fixed retention of Snapshot list expansion and scroll state so that it does not expand all items unexpectedly but remembers which sessions were collapsed and which extended ([PROFB-196](https://issuetracker.unity3d.com/product/unity/issues/guid/PROFB-196)).
11+
- Fixed dropdown text being clipped when "Allocated and Resident Memory on Device" was selected.
12+
- Fixed an issue whereby graphics allocations not associated with a native object would display under a "No Name" category in the All of Memory table.
13+
- Fixed issues with selecting array objects, or objects that had managed fields with arrays, when the arrays where multidimensional with one or more dimensions of size 0.
14+
- Fixed exception when opening the Unity Objects table in Comparison mode when there are multiple MonoBehaviour or ScriptableObject types with the same name but from different assemblies.
15+
- Fixed exception when opening the All Of Memory table in Comparison mode when either of the snapshots is from a pre 2022.2 runtime and the untracked amount is negative.
16+
- Fixed an ArgumentOutOfRangeException when inspecting some Managed Objects ([PROFB-223](https://issuetracker.unity3d.com/product/unity/issues/guid/PROFB-223)).
17+
- Fixed longer string values not being displayed in the Managed Fields Inspector.
18+
- Fixed an issue that caused IL2CPP VM memory to not be calculated correctly in the Summary and All Of Memory table.
19+
- Remove deprecated UxmlFactory/UxmlTraits API usage on Unity 6.
20+
- Add divider on "Capture" toolbar button dropdown.
21+
- Reattributed IL2CPP VM memory from Native to Managed in the All Of Memory table.
1922

2023
### Changed
21-
- Documentation updated.
22-
- The "Search In Project" button now searches in the Assets folder _and_ in Packages (related to ([PROFB-54](https://issuetracker.unity3d.com/product/unity/issues/guid/PROFB-54))).
23-
- Improved the performance of selecting items in the All Of Memory and Unity Objects tables for objects with managed memory. This affected in particular objects which have a lot of entries (their own or nested fields) displayed in their Managed Fields in the Selection Details panel. Beyond improving the performance in general, 'Continue...' entries, which can be clicked to get further entries added to the view, now not only appear in fields 4 layers down and for big arrays, but also after a total of 1000 field entries have been added to the view.
24+
- Allowed Snapshots to reside in Subfolders within the configured memory snapshot path.
25+
- Improved Snapshots folder monitoring: Changes to the folder are now reflected in the Editor without it requiring to acquire focus first.
26+
- Improved display of managed arrays in the Selected Item Details and Managed Fields.
2427

2528
For a full list of changes and updates in this version, see the [Memory Profiler Changelog](xref:changelog).

Editor/Containers/DynamicArray.cs

+26-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ unsafe interface ILongIndexedContainer<T> : IEnumerable<T>
3131
/// </summary>
3232
/// <typeparam name="T"></typeparam>
3333
[StructLayout(LayoutKind.Sequential)]
34-
unsafe readonly struct DynamicArrayRef<T> : ILongIndexedContainer<T> where T : unmanaged
34+
unsafe readonly struct DynamicArrayRef<T> : IEquatable<DynamicArrayRef<T>>, ILongIndexedContainer<T> where T : unmanaged
3535
{
3636
[NativeDisableUnsafePtrRestriction]
3737
readonly T* m_Data;
@@ -79,6 +79,31 @@ unsafe DynamicArrayRef(T* data, long lendth, bool isCreated)
7979
public readonly IEnumerator<T> GetEnumerator() => new DynamicArrayEnumerator<T>(this);
8080

8181
readonly IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
82+
83+
public readonly int GetHashCode(DynamicArrayRef<T> obj) => obj.GetHashCode();
84+
85+
public override int GetHashCode()
86+
{
87+
if (!IsCreated || Count == 0)
88+
return HashCode.Combine(Count, IsCreated);
89+
var hash = this[0].GetHashCode();
90+
for (long i = 1; i < Count; i++)
91+
{
92+
hash = HashCode.Combine(hash, this[i]);
93+
}
94+
return hash;
95+
}
96+
97+
public readonly bool Equals(DynamicArrayRef<T> other)
98+
{
99+
if (m_Data == other.m_Data)
100+
return true;
101+
102+
if (Count != other.Count)
103+
return false;
104+
105+
return UnsafeUtility.MemCmp(m_Data, other.m_Data, UnsafeUtility.SizeOf<T>() * Count) == 0;
106+
}
82107
}
83108

84109
/// <summary>

Editor/Containers/DynamicBlockArray.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ unsafe struct MemBlock
2828
public void* mem;
2929
}
3030

31-
unsafe struct DynamicBlockArray<T> : IDisposable where T : struct
31+
unsafe struct DynamicBlockArray<T> : IDisposable where T : unmanaged
3232
{
3333
public const int k_InitialBlockSlots = 8;
3434
MemBlock* m_BlockList;
@@ -59,7 +59,7 @@ public uint Capacity
5959

6060
public DynamicBlockArray(int blockSize, int initialCapacity)
6161
{
62-
Checks.CheckEquals(true, UnsafeUtility.IsBlittable<T>());
62+
Checks.CheckEquals(true, UnsafeUtility.IsUnmanaged<T>());
6363
m_BlockSize = blockSize;
6464
uint preAllocatedBlockCount = ComputeBlockCount((uint)initialCapacity, m_BlockSize);
6565
m_Capacity = preAllocatedBlockCount * (uint)m_BlockSize;

0 commit comments

Comments
 (0)