Big memory spike on new clean project.

Birlouz 1 year ago updated by Lazlo Bonin (Lead Developer) 12 months ago 5


I've observed a huge difference in memory consumption when importing Peek in a project.

I've tested it on a new Unity 2020.1.5.f1, new URP project. I just launch the new project and install the Peek package via Unity's package manager and press Shift+Space to enter "single window" mode.

I'm on Windows 10.

A screen of the project WITHOUT Peek:

1240 Mo of memory used.

A screen of the project WITH Peek:

3921 Mo of memory used.

I've used your asset a little and I found it very usefull. I'd like to work more with it, but for the moment it's impossible (because of memory consumption, ther was a lot of Unity crash). I hope you'll find the issue (or we find, the fault may be mine ...) !

Best regards,

Unity Version:
Peek Version:

Excellent reactivity, clear explanations, very good quality of support !

Satisfaction mark by Birlouz 12 months ago

Hi Birlouz!

I'm sorry you're experiencing this memory issue.

My gut feeling is that this may be caused by preview generation, which I know I have to optimize and move away from the built-in Unity preview generation. Can you try disabling Preview Icons in the Peek Preferences?

If that doesn't fix it, please upload a screenshot (or even better a capture) from the Unity Profiler window with Editor Profiling + Deep Profiling enabled during one on those spikes.

I've try disabling  "Preview Icons" and it doesn't change a lot :

So I tried to capture 2 moments.
The first is directly at Unity's opening when the memory grows to 3.5 Go


The second is after opening, when I can manipulate the Peek toolbar :
- I open "File" and "Console" windows
- Give them focus by clicking on them
- And close the "Console" by clicking on the Peek toolbar button.

At this moment, Unity hangs, a Unity message appears ("Application.Message"), memory goes up to ~9 Go for a moment and goes down to ~7 Go.
WeTransfer Link

I use WeTransfer for the 2nd link because upload didn't seems to work, surely this file is too big (40 Mo compressed).

Thank you for your reactivity on the forum, it's very appreciable !

Best regards,

Hi Birlouz,

Thanks for sending the profiler snapshots.

It's hard to tell what happened in the first snapshot, right after opening the Unity editor, because I don't have the frame where the spike grows. What I can confirm though is that it's managed memory taking up to 1.5GB of RAM and not getting released, so Peek is a potential culprit, seeing as it's written on the managed side.

The second snapshot is more interesting. We see the specific frame where Peek allocates a whopping 2.95 GB of garbage. By digging down, we see this:

It seems like the allocation is caused by Peek saving your editor preferences to EditorPrefs, which happens through Odin Serializer serializing them as a string. For some reason, that string is enormously large (0.5GB itself) then gets flushed to a stream (0.78GB) etc.

This means that somehow, your Peek editor preferences grew to an enormous size in data. The only culprit I can think of is the "tabs data" that we save, which includes the serialized window data using EditorJsonUtility.ToJson. Therefore, you might have a window open in your project that has an insane amount of serialized data within it, which creates this big string.

My first recommendation would be to:
1. Close any suspicious window from a third-party asset or from your custom scripts
2. Reset your Peek Editor Preferences and Project Settings
3. Restart Unity

On my end, I tried reproducing this issue with a vanilla URP project, Peek 1.1.9 and Unity 2020.1.5f1 and I can confirm that the managed memory load stays at around a meager 50MB, even after saving the preferences, so there seems to be something specific to the rest of your setup causing this.


First of all, I would like to thank you for your quick reactivity on the forum, it's very appreciable !

As I was writing you a new post, I tried new test that didn't change anything, and then, as you said, I tried resetting the Editor Preferences and Project Settings.

And voilà !
No more memory spike when I open/close a window via Peek toolbar !

I still don't know where the problem comes from, but I know that the key is in at least in one of this two windows.

Now, memory stays around 1.4 GB on a plain new vanilla URP project and Peek, and not 5 GB or 9 GB :)

If I find exactly what was the cause of these spikes, I will let you know (on this post or on Discord ?).

Thank you for your help, and for this great asset !

Best regards,


Hi Birlouz,

Glad you got it resolved for now! I'll close this thread for the moment, but feel free to reply again if you get the spike to consistently reproduce (it's better here than on the Discord, this way I can provide individual status updates on each issue).