Where Are You Wasting Your Game’s Memory? (Part 1)
In this post, you will show you how to use the experimental Unity Memory Profiler package to find exactly where you are wasting memory on your game.
In this post, you will show you how to use the experimental Unity Memory Profiler package to find exactly where you are wasting memory on your game.
Here's what we will cover in part 1:
- What is this mysterious Unity Memory Profiler?
- How you can start profiting from the Unity Memory Profiler right away.
- Steps to find memory optimization opportunities for your game to reduce crashes and loading times

Quick Navigation
1. What's the Unity Memory Profiler?
2. How to Start Using the Unity Memory Profiler Right Away
3. How to Find Memory Optimization Opportunities in Your Game
1. What's the Unity Memory Profiler?
The Unity Memory Profiler is an experimental package that will let you find where exactly you're spending the memory of your game.
In other words, it will let you:
- Reduce crashes due to oversized memory allocation.
- Decrease loading times
- Find memory leaks
- Fit your game in weaker devices → increase your sales
You can use this tool in a variety of ways:
- You can debug a single memory snapshot or compare/diff two snapshots.
- You can visualize the memory representation in a tree map (shown below), as a memory map or in tabular mode.

Unity Memory Profiler Snapshot: Tree View
Let's see how you can start using this tool right away.
2. How to Start Using the Unity Memory Profiler Right Away
As with every package, the installation is straight forward.
Open the package manager (window → package manager) and enable the experimental packages in the advanced section.
* Note: on Unity 2020.2 and above, you enable the experimental packages in a different place. Find this option in project settings → package manager. I guess this is Unity's way to make it harder to find these packages, so people stop complaining about their instability (too much PR noise).

Unity 2020.2+: Enabling Preview Packages
Once you installed this package, open the Memory Profiler (Window → Analysis).
In the Unity Memory Profiler window, select the target player running the project you want to analyze, e.g. editor, android, SNES, Gameboy, etc..
And then, you know what to do. Hit the capture button.
Note: avoid capturing on the editor, as it introduces tons of noise. In my case, Unity wouldn't capture a player snapshot so I had to go for the editor (did I mention it might be unstable?).
3. How to Find Memory Optimization Opportunities in Your Game
So you clicked on the capture button and went to grab a coffee.
After a few seconds (or minutes (or hours (or never))), you'll be able to open the snapshot you just captured.
Unity will show you by default the tree map of your game's memory layout at the time of the capture.
Each segment displays a single asset type plus its size in RAM, as you can see below.

Unity Memory Profiler Snapshot: Tree View
Now, here's the cool thing: you can click on the that segment and it'll instantly flip to show the specific assets that are stealing your memory.
Here, take a closer look at the Texture2D section that I just opened:

Unity Memory Profiler Snapshot: Opening a Tree Section
You see? This is a very straight-forward way of seeing how well (or badly) you're distributing the memory of your game.
In my case, it seems like there's something weird with one of my textures: PlasticRidges_Albedo_MemoryGreedy.
It's somehow taking 85MB...
I wonder... what's going on here?

I think I've seen this asset before. Let me double check...
So I navigate to that asset and instantly find what's wrong.
REALLY?

Unity Texture: Uncompressed Format
Whooops, Ruben sloppily "forgot" to turn on the texture compression for this blog post.
Easy fix.

Unity Texture: DXT1 Format
Let me recap the process:
- Install the (experimental) memory profiler package.
- Open it and capture the game state you want.
- Click on the bigger sections to analyze which assets are taking more memory than you'd expect.
- Diagnose what's going on with these assets (mostly import settings).
- Fix them.
- Ship it.
By following this process, you will be able to spot memory optimization opportunities.
Here are other thingies you can find: excessive shader variants, scripts with huge heap data, oversized render textures, memory leaks... the list goes on.
In part 2 of the Unity Memory Profiler series, I'll go in more detail about the different visualization modes that we didn't cover today:
- Memory Map
- Table Mode
Why not today?
Because they are advanced and I think you and I should start it with a fresh mind.
So, What's Next?
Honestly, repeating "get my free Unity Performance Checklist" is getting a bit old.
Oops, I just said it again.
Anyway, just for today I'll make an exception and say...
Go play with the Unity Memory Profiler and have some fun.
You'll be surprised to see what it reveals of your game 😉
~Ruben
Recommended resources
Game Engines
Unreal Engine 5 Best Practices
Amazon · Book
Written by multi-award-winning Unreal generalist Tyson J. Butler-Boschma, Founder and Creative Director of Toybox Games Studios, this book addresses common challenges you face when advancing your expertise in lighting, environment design, and cinematic storytelling.
GameDev.net may earn a commission if you purchase through these links. This helps fund the site at no extra cost to you.
Related Tutorials
Balancing Game Development and Creative Direction in Indie Production
A practical look at how indie developers can balance creative direction with hands-on game development. This article co…
My Unreal Engine Development Process: From Core Idea to Playable Build
A practical overview of my Unreal Engine development process, covering how I move from a core game idea to a playable b…
Introducing LaneGraph: The Ultimate Road Network Solution for Unity
Discover the power of LaneGraph, a lightweight and flexible lane-based navigation system for Unity. LaneGraph makes it…
Retargeting Mixamo Characters with Root Motion In Unreal Engine 5.4.
I have always found Retargeting Mixamo Characters To have Root Motion is a serious lengthy Tast, Recently I stumbled up…
How To Make A SIMPLE Main Menu In Unity
In this tutorial for unity, i go over how to make a simple main menu for unity, it's an unlisted video because i do not…
Guide to Gameplay Balance
A perspective on competitive gameplay balance, from a background of "shooter" sandbox design.
Discussion
More from Ruben Torres Bonet (The Gamedev Guru)
Static Batching Like You Never Saw
Most developers think they know how static batching truly works. But that’s a lie: they don’t.
Ruben Torres Bonet (The Gamedev Guru)
Don't Let Offscreen Objects Ruin Your Performance - Unity CullingGroup API
Learn how to make your expensive scripts cost nothing while they are offscreen.
Ruben Torres Bonet (The Gamedev Guru)
Raycast Commands: A New Performance Era
Learn how to stop your current raycasts from stealing performance and upgrade them to the new era of Unity raycast comm…
Ruben Torres Bonet (The Gamedev Guru)
Discussion