Skip to content

Commit de22099

Browse files
author
Unity Technologies
committed
## [1.1.5] - 2025-02-14 ### Added - Managed fields referencing native allocations are now parsed as references. References show up in the References To tab for the managed objects holding the references, as well as in the Referenced By tab for native allocations under `Native > Unity Subsystems > UnsafeUtility` in the All Of Memory table. Note that this is not an exhaustive list of all references to these allocations, as stack variables could reference them as well but are not part of the snapshot. Thus, a native allocation without references is not necessarily leaked. - Native Allocations (e.g. those listed in `Native > Unity Subsystems > UnsafeUtility` in the All Of Memory table) are now named based on the field and object information of the first managed reference to them, making them easier to parse than address values and stand out from the list as having reference information. ### Fixed - The Boehm GC treats any pointer sized field as potential managed pointer. So far the Memory Profiler only examined reference fields to find referenced objects (outside of those directly held by static fields or GCHandles). The Memory Profiler does not yet follow this logic as it would end up finding invalid Managed objects, but it now finds references from unsafe pointer fields to Managed Objects that are also held by a GC Handle. - The Managed Fields table now shows any pointer sized fields that might be holding managed objects as referencing these managed objects (Note: if they are not referenced otherwise, they won't sho up in the other tables). ### Changed - The References To table now shows field information for references held by managed fields
1 parent febc405 commit de22099

32 files changed

+1657
-730
lines changed

.signature

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"timestamp":1738934362,"signature":"PahCXx+n/0Q6wc/vJrIQTSBAWEkx0RA5lk8urgiDDHwwjdu3yG/Jkk7Ru/pzM9ClPCjVtR9F7nD55FN1Z2kI+7U7PXP+wjTE95nRVn0LYqqE7z+mM0/v/xVZ6ULYGSPT72gfclcAWfeg+U5ub0YyoDs/8mgBxJZRwHIySkcwhiHZZ+uB8LUQWUwI5N+QK2nheZUshu1YFe+0CR5O9tL6VmeRkSBQvpuhdwvNaHprAJlwqM4VuyGCpURz91Z8DedyYyBzuvMYq+JeHLSfLqubopVvYl9XhLEYVsrz/I/j1Hlx12zxuayoLGG1qE7Hra6FyYX8zUIn5zbrqaacZt0/LvhpK2gGwC298YMY2SI+D9xZ2KCQXDYr3muM5uNgtAC7wVjMwdbCyNxiNXQ56m4Ar07M54uNdM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SllDM0V2UE16ZGdKUzdGR2FscnFLZzlPTCsxVzROY05yNWdveVdSUUJ0cktKaWlTZEJVWmVxb0RvSUY5NHpCCndGbzJJT1JFdXFqcU51M3diMWZIM3p1dGdtalFra3IxVjJhd3hmcExLWlROQWdNQkFBRT0KLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg"}

CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ 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.5] - 2025-02-14
11+
12+
### Added
13+
- Managed fields referencing native allocations are now parsed as references. References show up in the References To tab for the managed objects holding the references, as well as in the Referenced By tab for native allocations under `Native > Unity Subsystems > UnsafeUtility` in the All Of Memory table. Note that this is not an exhaustive list of all references to these allocations, as stack variables could reference them as well but are not part of the snapshot. Thus, a native allocation without references is not necessarily leaked.
14+
- Native Allocations (e.g. those listed in `Native > Unity Subsystems > UnsafeUtility` in the All Of Memory table) are now named based on the field and object information of the first managed reference to them, making them easier to parse than address values and stand out from the list as having reference information.
15+
16+
### Fixed
17+
- The Boehm GC treats any pointer sized field as potential managed pointer. So far the Memory Profiler only examined reference fields to find referenced objects (outside of those directly held by static fields or GCHandles). The Memory Profiler does not yet follow this logic as it would end up finding invalid Managed objects, but it now finds references from unsafe pointer fields to Managed Objects that are also held by a GC Handle.
18+
- The Managed Fields table now shows any pointer sized fields that might be holding managed objects as referencing these managed objects (Note: if they are not referenced otherwise, they won't sho up in the other tables).
19+
20+
### Changed
21+
- The References To table now shows field information for references held by managed fields
22+
1023
## [1.1.4] - 2025-02-07
1124

1225
### Added

Editor/Containers/MetaDataHelpers.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ enum AvailableMetaDataTypes
9494
}
9595
}
9696

97-
internal static bool GenerateMetaDataString(CachedSnapshot cs, int nativeObjectIndex, out List<(string, string)> metaDataStrings)
97+
internal static bool GenerateMetaDataString(CachedSnapshot cs, long nativeObjectIndex, out List<(string, string)> metaDataStrings)
9898
{
9999
if (!cs.HasNativeObjectMetaData || nativeObjectIndex == CachedSnapshot.NativeObjectEntriesCache.InvalidObjectIndex)
100100
{

Editor/MemoryProfilerWindowContent.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,15 @@ internal static class TextContent
156156
public const string HeldByGCHandleStatus = "Held Alive By GCHandle";
157157
public const string HeldByGCHandleHint = "This Object is pinned or otherwise held in memory because a GCHandle was allocated for it.";
158158

159+
public const string UnityObjectHeldByGCHandleStatus = "Unity Object Held Alive By GCHandle";
160+
public const string UnityObjectHeldByGCHandleHint = "This Object has an m_CachedPtr field, indicating it is a Unity Object, yet no native object holding its GCHandle was captured in the snapshot. This could be due to a bug where native objects could change between taking a snapshot of the managed heap and capturing native objects. This was fixed in 6000.0.16f1, 2022.3.43f1, and 2021.3.44f1 so if you are on Unity versions higher than those, please report a bug.";
161+
159162
public const string UnkownLivenessReasonStatus = "Bug: Liveness Reason Unknown";
160163
public const string UnkownLivenessReasonHint = "There is no reference pointing to this object and no GCHandle reported for it. This is a Bug, please report it using 'Help > Report a Bug' and attach the snapshot to the report.";
161164

162165
public const string InvalidObjectErrorBoxMessage = "This is an invalid Managed Object, i.e. the Memory Profiler could not identify it's type and data. To help us in finding and fixing this issue, " + TextContent.InvalidObjectPleaseReportABugMessage;
163166

164-
public const string UnknownUnknownAllocationsErrorBoxMessage = "This is a bug in the netive code of the engine, please file a bug report. " +
167+
public const string UnknownUnknownAllocationsErrorBoxMessage = "This is a bug in the native code of the engine, please file a bug report. " +
165168
"Chances are high that every single allocation here is a separate bug to be fixed by a different team and should be treated as such. " +
166169
"By their very nature, User facing releases lack the information needed to differentiate these allocations in a meaningful way. " +
167170
"To get an approximation of what constitutes a separate vs a duplicate bug the byte size of each allocation should be used (size in byte is given when hovering the Native Size). " +

0 commit comments

Comments
 (0)