1.0.0-preview.14 UI Toolkit ran out of computer memory and video memory, causing the system to hang

At first, the system will be restored to a usable state after a while, but some programs and unity editors will crash, and there is no other significant impact. This time it completely stuck, causing me to force shutdown

PC Info:
Windwo 10 Professional
Windows Feature Experience Pack 120.2212.551.0
Version: 19042.804 , 20H2
RAM: 24G
GPU:GTX1060 6G

Unity Ver: 2021.1.0b3

trigger: The editor plays the game repeatedly. After I develop and modify the code and USS, after playing the game n times, it will cause the following situation to happen


6868865--801500--ezgif.com-gif-maker (1).gif

It may also be related to ui builder

This will need an investigation.

Can you submit a bug report with steps to reproduce? We will try to reproduce on different hardware as it seems driver related.

I will try to create a new project later to test it

I spent an afternoon trying to reproduce the problem in a test project, but I couldn’t reproduce it except for the memory exhaustion. The memory exhaustion should have nothing to do with uitoolkit. I loaded 720 Texture2D images with an average size of 75kb. The situation encountered in my project development is really difficult to reproduce. Why do I use pictures to test it? My program is a music player. In the editor, I will cache the album pictures when reading the song information. He is good when using UGUI and has not encountered such a problem

Is 75kb the size of the PNGs/JPGs? If so, the actual uncompressed size stored in graphics memory may be much higher.

If you can’t reproduce the bug consistently, can you still share a demo project in this thread? This would allow us to monitor the memory requirements for your use-case.

Fatal Error in GC I need to proactively trigger once to determine the problem, so it is not easy to make a reproduction project, which may be very slow

Yes, the average size of the picture is 75kb. The test project for system problems caused by memory overflow has been written. But it is different from what I encountered in the actual project. If I need it, I can package it. This project can let me A similar error occurs on the computer, the computer flashes, the video player stops due to insufficient memory, the browser web page crashes due to insufficient memory, some other software and Unity crash

If you can still share a demo project here (even without reproduction steps), it could help us see how your particular project allocates memory, and find potential problems.

OK, wait a minute, I will make a simple project

I wrote a simple project. Every time I play the game, the memory will increase. It may be a problem with FontAsset, but I still don’t know how to cause the Fatal error GC. I encountered it 3 times after I changed my project to UIToolkit.

Unity Version:2021.1.0b3.1775

Edit the MusicFolderPaths of the MusicListPageBehave component of the UIDocument object in the SampleScene scene, add the music directory

6872891–802259–SimTestMusicInfoRead.rar (1.09 MB)
6872891--802262--1.png

1 Like

I suddenly remembered that there were 2 virtual xxmapxx errors, and the error behavior was the same.

Thanks for sharing the project. We were able to reproduce the problem.

It turns out that we have a ton of font data that is leaking between each play/stop. This will be fixed in preview.15. Thanks for reporting!

You’re welcome