[1117188] [Fixed] Memory Profiler: GUI errors when opening a snapshot, can't diff snapshots

I've been trying out the new Memory Profiler in 2018.3 preview packages, hoping to track down some memory leaks in our game. Unfortunately I've run in to some errors while using it. I'm able to capture a snapshot from our standalone-win build, but then run in issues when I try to open that snapshot.

First there are a bunch of warnings like this:

Duplicated object in gc handles 1 addr:2240879204432

The snapshot is able to load and display the tree map, but interacting with it causes these exceptions to spam:

Exception: Unhandled exception. To get additional information add in project settings "scripting define symbols" : MEMPROFILER_DEBUGCHECK
bad object
at Unity.MemoryProfiler.Editor.ObjectData.FromManagedObjectIndex (Unity.MemoryProfiler.Editor.CachedSnapshot snapshot, Int32 index) [0x00072] in C:\HMX\kzero\kzero\kzero\Library\PackageCache\com.unity.memoryprofiler@0.1.0-preview.4\Editor\Profiler\ObjectData.cs:706

(adding the MEMPROFILER_DEBUGCHECK define does not actually give any additional info)

As well as these errors:

GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced.
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

For the most part, it seems like I can navigate the UI in spite of these errors. But when I open two snapshots and try to diff them, I get the following warning, and the diff fails to open.

Diff between tables with multiple primary key column is not supported yet. Table 'RawNativeTypeBase'

Do you know what could be causing these errors in our memory snapshots, and is there any way to resolve or work around them from our end? I would especially like to get the diff tool working, since it would be the most useful for tracking down leaks. I can provide a snapshot file, but I can't upload it here as it's ~130MB.

Thank you,
Dan Nottingham

Hi Dan,

I can't say if there is a current workaround for this right of the bat, but could you please file a Bug Report with the 2 snapshot files you used for diffing attached? Zipping them should also reduce their size greatly. Once reported, please post the BUG ID here so we can pick it up faster. Since this is a package, once we and resolved the issue we can then update the package with that fix relatively quickly to hopefully unblock you.

Thank you,

Also, which version of the Memory Profiler Package are you using?

nevermind the previous comment, just noticed the version was in the log you posted:
com.unity.memoryprofiler@0.1.0-preview.4 i.e. latest.

I've filed a bug report with the snapshots attached, 1117188. Hope that helps!


we also have same issue but platform is android.
Is this fixed yet??
we use 0.1.0 version.

@Jee-Hyunho Yes it should be fixed in 0.1.0-preview.5. You can see which preview version you have in the Package Manager.


Hey guys, Unity 2019.2.5f1 and the latest version of the Memory Profiler and this is till happening. bad object exception etc

@marioslokas I'm assuming you're profiling a build made in the same version you are profiling from, in which case it definitely should have been fixed and we'll need more info to find out why it isn't. Could you please file a bug for this and mention case 1117188 in there?

1 Like

I have attempted to recreate the bug in a clean project and mine and it stopped appearing (heisenbug?). Diff table shows up normally when comparing two snapshots.

... weird. Well, in any case, if you or anyone else manages to reproduce it, please do file a bug report. Also, 2019.2.x has just dropped out of support and 2019.3 has a major improvement in capture & processing time and reliability. The way gc handles are processed in 2019.3 has changed too so I'd be very surprised if this still reproduces there.