diff --git a/CHANGELOG.md b/CHANGELOG.md index ad4a429..7486304 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,13 @@ All notable changes to this package are documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [4.1.2] - 202?-??-?? +## [4.3.0] - 2024-11-21 ### Fixed + - Fixed a memory leak that occurred when capturing an editor memory snapshot, then closing and reopening Heap Explorer to take another snapshot. Thanks to marvelous007x for the report. See [Issue #17](https://github.com/pschraut/UnityHeapExplorer/issues/17) for details. + +## [4.2.0] - 2024-11-06 +### Fixed + - Fixed compile errors starting with Unity 2022.2. This also addresses PR #16 (Thanks Chris) - Fixed ```ComputeConnectionKey``` possibly causing an overflow and showing wrong connections. Thanks to Yi Ji for sending me the fix. - Fixed ```IndexOutOfRangeException``` when capturing a memory snapshot that contains obfuscated code. Thanks to UlyssesWu for the fix. See [PR#14](https://github.com/pschraut/UnityHeapExplorer/pull/14) for details. diff --git a/Editor/Scripts/HeGlobals.cs b/Editor/Scripts/HeGlobals.cs index a5b6ddf..7cdb6d9 100644 --- a/Editor/Scripts/HeGlobals.cs +++ b/Editor/Scripts/HeGlobals.cs @@ -1,5 +1,5 @@ // -// Heap Explorer for Unity. Copyright (c) 2019-2021 Peter Schraut (www.console-dev.de). See LICENSE.md +// Heap Explorer for Unity. Copyright (c) 2019-2024 Peter Schraut (www.console-dev.de). See LICENSE.md // https://github.com/pschraut/UnityHeapExplorer/ // using System.Collections; @@ -11,7 +11,7 @@ namespace HeapExplorer public static class HeGlobals { public const string k_Title = "Heap Explorer"; - public const string k_Version = "4.1"; + public const string k_Version = "4.3"; public const string k_DocuUrl = "https://github.com/pschraut/UnityHeapExplorer"; public const string k_ChangelogUrl = "https://github.com/pschraut/UnityHeapExplorer/blob/master/CHANGELOG.md"; public const string k_ForumUrl = "https://forum.unity.com/threads/wip-heap-explorer-memory-profiler-debugger-and-analyzer-for-unity.527949/"; diff --git a/Editor/Scripts/HeapExplorerWindow.cs b/Editor/Scripts/HeapExplorerWindow.cs index 277a026..dda768e 100644 --- a/Editor/Scripts/HeapExplorerWindow.cs +++ b/Editor/Scripts/HeapExplorerWindow.cs @@ -1,5 +1,5 @@ // -// Heap Explorer for Unity. Copyright (c) 2019-2020 Peter Schraut (www.console-dev.de). See LICENSE.md +// Heap Explorer for Unity. Copyright (c) 2019-2024 Peter Schraut (www.console-dev.de). See LICENSE.md // https://github.com/pschraut/UnityHeapExplorer/ // #pragma warning disable 0414 @@ -10,6 +10,12 @@ using System; using System.Threading; +#if UNITY_2022_2_OR_NEWER +using UnityMemoryProfiler = Unity.Profiling.Memory.MemoryProfiler; +#else +using UnityMemoryProfiler = UnityEngine.Profiling.Memory.Experimental.MemoryProfiler; +#endif + namespace HeapExplorer { public class HeapExplorerWindow : EditorWindow @@ -181,6 +187,7 @@ void OnDisable() EditorApplication.update -= OnEditorApplicationUpdate; + CloseFile(); DestroyViews(); } @@ -801,7 +808,7 @@ void CaptureAndSaveHeap() m_IsCapturing = true; string snapshotPath = System.IO.Path.ChangeExtension(path, "snapshot"); - UnityEngine.Profiling.Memory.Experimental.MemoryProfiler.TakeSnapshot(snapshotPath, OnHeapReceivedSaveOnly); + UnityMemoryProfiler.TakeSnapshot(snapshotPath, OnHeapReceivedSaveOnly); } finally { @@ -847,7 +854,7 @@ void CaptureAndAnalyzeHeap() m_IsCapturing = true; var path = FileUtil.GetUniqueTempPathInProject(); - UnityEngine.Profiling.Memory.Experimental.MemoryProfiler.TakeSnapshot(path, OnHeapReceived); + UnityMemoryProfiler.TakeSnapshot(path, OnHeapReceived); } finally { diff --git a/LICENSE.md b/LICENSE.md index c1b6596..b813421 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019-2022 Peter Schraut (http://www.console-dev.de) +Copyright (c) 2019-2024 Peter Schraut (http://www.console-dev.de) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/README.md b/README.md index a9cf3ee..bc24ca4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Introduction -Heap Explorer is a Memory Profiler, Debugger, and Analyzer for Unity. This repository hosts Heap Explorer for Unity 2019.3 and newer versions. For older versions, please visit the obsolete repository on Bitbucket instead ([link](https://bitbucket.org/pschraut/unityheapexplorer/)). +Heap Explorer is a Memory Profiler, Debugger, and Analyzer for Unity 2019 up to Unity 6. I have spent a significant amount of time in the past identifying and fixing memory leaks, as well as searching for memory optimization opportunities in Unity applications. During this time, I often used Unity's [old Memory Profiler](https://bitbucket.org/Unity-Technologies/memoryprofiler). While it's a useful tool, I was never entirely satisfied with it. @@ -12,15 +12,13 @@ After much consideration about what to do with Heap Explorer, I concluded that t Since then, I have provided occasional updates because several people still prefer Heap Explorer over Unity's Memory Profiler due to its easier-to-understand UI/UX. -I have also updated Heap Explorer to work with Unity 2019.3 and converted it into a Package, which means you should be able to use Heap Explorer for the entire 2019 LTS cycle, which ends in 2022. +I do however recommend to install Unity's own Memory Profiler, because I believe it's superior in various ways to Heap Explorer now in the year 2024. [![](http://img.youtube.com/vi/tcTl_7y8JBA/0.jpg)](https://www.youtube.com/watch?v=tcTl_7y8JBA "") # Installation -In order to use the Heap Explorer, you have to add the package to your project. As of Unity 2019.3, Unity supports to add packages from git through the Package Manager window. - In Unity's Package Manager, choose "Add package from git URL" and insert one of the Package URL's you can find below. Once Heap Explorer is installed, you can open it from Unity's main menu under "Window > Analysis > Heap Explorer". @@ -32,6 +30,8 @@ Please see the ```CHANGELOG.md``` file to see what's changed in each version. | Version | Link | |----------|---------------| +| 4.3.0 | https://github.com/pschraut/UnityHeapExplorer.git#4.3.0 | +| 4.2.0 | https://github.com/pschraut/UnityHeapExplorer.git#4.2.0 | | 4.1.1 | https://github.com/pschraut/UnityHeapExplorer.git#4.1.1 | | 4.1.0 | https://github.com/pschraut/UnityHeapExplorer.git#4.1.0 | | 4.0.0 | https://github.com/pschraut/UnityHeapExplorer.git#4.0.0 | diff --git a/Tests/Editor/Test_Editor.cs b/Tests/Editor/Test_Editor.cs index b894bac..8b211df 100644 --- a/Tests/Editor/Test_Editor.cs +++ b/Tests/Editor/Test_Editor.cs @@ -1,5 +1,5 @@ // -// Heap Explorer for Unity. Copyright (c) 2019-2022 Peter Schraut (www.console-dev.de). See LICENSE.md +// Heap Explorer for Unity. Copyright (c) 2019-2024 Peter Schraut (www.console-dev.de). See LICENSE.md // https://github.com/pschraut/UnityHeapExplorer/ // #pragma warning disable 0414 @@ -12,6 +12,12 @@ using System.Collections; using System.Collections.Generic; +#if UNITY_2022_2_OR_NEWER +using UnityMemoryProfiler = Unity.Profiling.Memory.MemoryProfiler; +#else +using UnityMemoryProfiler = UnityEngine.Profiling.Memory.Experimental.MemoryProfiler; +#endif + namespace HeapExplorer { interface ITestInterface @@ -42,7 +48,7 @@ public Test_Editor() public IEnumerator Capture() { var path = FileUtil.GetUniqueTempPathInProject(); - UnityEngine.Profiling.Memory.Experimental.MemoryProfiler.TakeSnapshot(path, OnSnapshotReceived); + UnityMemoryProfiler.TakeSnapshot(path, OnSnapshotReceived); var timeout = Time.realtimeSinceStartup + 15; while (m_snapshot == null) diff --git a/package.json b/package.json index 9a2b360..e0d6e03 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.oddworm.heapexplorer", - "version": "4.1.2", + "version": "4.3.0", "displayName": "Heap Explorer", "description": "Heap Explorer is a Memory Profiler, Debugger and Analyzer for Unity. You can open it from the main menu 'Window > Analysis > Heap Explorer'.", "documentationUrl": "https://github.com/pschraut/UnityHeapExplorer",