Introducing the new Memory Profiler
The new Unity 4.1 release features an updated and vastly more powerful Memory Profiler tool that provides more specific and more accurate information about game performance, both for games running within the Editor and games running directly on specific devices.
Update: The Memory Profiler described in this blog post is no longer being maintained. All work on memory profiling has moved to the new Memory Profiler package (September 4, 2019).
With the new tool, it’s much easier for developers to tackle the leaks that inevitably arise during development and that Unity’s garbage collection can’t pick up on because they relate to referenced game elements.
Gathering more detailed information
The estimate performed by the original Memory Profiler provided a good approximation of memory usage by tracking selected asset types. In the new version of the Memory Profiler however, all game objects and asset types are tracked along with several internal Unity structures. In this way, the new tool provides much more precise information about how much memory is allocated to various areas.
To provide just one example, the old tool estimated how much memory an animation used based on the various animation tracks. The problem is that such an estimate quickly becomes outdated and needs to be kept in sync. with development. In the new Memory Profiler, every allocation related to the animation is linked automatically, and the numbers shown reflect real-time memory usage on the platform.
Providing a detailed breakdown
As well as making data more accurate, tracking more memory also allows the new Memory Profiler to provide much more detailed information to the developer about how memory is used. The new tool lists each asset and its memory consumption individually allowing the user to check which ones are using more memory than they really should.
Plus, the updated Memory Profiler also provides a better system-level breakdown. Unity has a number of internal systems that use a lot of memory: for example the Shader Lab and internal file caches. Developers can now see how these internal systems affect memory usage when their game is running on the Editor, and how they use less memory or are stripped out completely when the game plays on a device.
A major ongoing project
The new Memory Profiler has been under development for some time, and a lot of preparation has gone into it as it’s something that touches on all Unity systems – everything uses memory.
For us as a company, the new Memory Profiler also provides useful information about the way that Unity uses memory which we’ve used to tweak and trim the engine in various places.
In future, we hope to further develop the tool, and our ultimate aim is to provide total transparency about where every single byte in Unity goes.
27 CommentsSubscribe to comments
Comments are closed.