0
Cannot Fix

Peek renders Project window unresponsive (huge memory spike) when browsing hits big prefabs in a folder

Andras Gregori 4 months ago updated 3 months ago 9

So all seems fine until the Project window hits large fbx's or prefabs in a given folder: then there's a huge memory leak (seen in TaskManager) and the editor is unresponsive. Showstopping issue is resolved when Peek is uninstalled.
I also tried tweaking all things in Peek preferences, to no avail.

Unity Version:
2019.2.16
Peek Version:
1.1.6
GOOD, I'M SATISFIED
Satisfaction mark by Andras Gregori 2 months ago
It happens with a folder with complex fbx's such as DAZ characters as shown. Again, it resolves when Peek's uninstalled.

Hi Andras,

Sorry you're experiencing this issue and thanks for submitting a bug report. Could you please provide more information about the FBX files:

1- How many files do you have in the folder
2- How large are most of the files
3- How large are the files that specifically cause the memory leak
4- Do you have any other programs running simultaneously?

Kind regards,
Hasan from Ludiq

Hi Hasan, thanks.

1. There are about 22 fbx's in the folder.

2. Some DAZ fbx's are actually 100Mb large, most are about 50Mb.

3. I don't know which files cause the leak: the editor is unresponsive as soon as I enter the folder.

4. VS2019 and Total Commander are normally on in the background, but the same happens without them.

+1

Hello Andras,

Thanks for the information and for your patience on this matter, since this is not something I can easily reproduce myself I will be escalating it to our lead developer.

Kind regards,

Hasan from Ludiq

Need More Information

Hi Andras,

Thanks for your patience with this. I'm back from holidays and can finally investigate what's causing the unresponsiveness.

Is there any chance I could download some of the DAZ files to test for myself?

This would let me profile the editor and see what causes the hang.

In the mean time, my educated guess for a workaround would be to disable the previews in Peek. You can do so from: Edit > Preferences... > Ludiq > Peek > Preview Icons (uncheck).

Hi Lazlo, thanks for investigating the memory leak. The error occurs with or without Preview Icons & Probe checked.
I just did a fresh project with only Peek installed, and using only 4 large fbx's (with calculated normals, humanoid rig, and extracted materials in order to simulate real-world usage). There is no leak and no editor lag. This suggests that it is the actual volume of fbx's that breaks Peek, not the mere presence of a few fbx's in the folders. 



In any case, I provide a link to one of my self-made Daz3D fbx's. But a single fbx will not trigger the error.
https://mega.nz/#!qtkiBCRT!uvzAITn_ggtJ7T8K2dYqc4U745n78j0DS4RFeOa1P8c

+1
Cannot Fix

Hi Andras,

I tried this more minimally with about 4-5 copies of your FBX file.

The temporary hang seems to come from AssetDatabase.LoadMainAssetAtPath, which Peek uses to be able to see the components and enable its various utilities on each asset in the folder. 

This is an internal Unity function that runs on the main thread, so it hangs the editor until it's done.

Basically, we're asking Unity to read and load complex 50MB+ files and all their import settings, transforms, rig, etc. For 22 FBXes, that's at least 1GB of memory and processing you're asking to load at once.

What I'm assuming you see is that Unity runs out of RAM, so it tries to discard the loaded data about the DAZ assets. This forces Peek to reload it the next time in order to be able to show its toolbars, causing a slow operation again. Somewhere along the way, there might be a leak internally, or a reference kept longer than it should for a while.

I'm not sure I can fix that. LoadAssetAtPath is needed to get any information about the asset in the project folder besides its path. Without it, I can't display the icon, tooltip, or toolbar. And I can't optimize that function as it's an internal function.

As a side node, I have to say that I've personally never seen any FBX model take that long to import or load even if I worked with complex characters before, and I wonder if they are optimized or made to be compatible for Unity.

I was going to suggest that, as a last resort, you could disable the Peek Project Toolbars altogether from the preferences. This would let you use Peek still. But there's a small issue with the core library that's going to make it load the asset anyway in the current version, which I could fix. But more importantly, the loading time would still be present if you used any of these FBXes in the scene, or from the creator menu, etc. There's no real way around it AFAIK, sorry. :/

Hi Lazlo, thank you for a detailed reply, it was helpful. Your explanation provides a likely scenario, and I'll invest in more RAM and a stronger CPU soon, the combination of which may improve similar Fbx-related lags among other things. 

"I wonder if they are optimized or made to be compatible for Unity"

They're standard mid-poly Genesis 8 characters, but with loads of 4096x4096 texturing. Granted, Unity doesn't "like" newer Daz characters out of the box, which may be a big part of the problem. In any case, thank you for having investigated it. I'll continue using Peek with or without these Fbx's because it's a great tool.