GfxDriver memory issue on PC [SOLVED]
Edit: Upgrading project to version 2020.1b10 solves the problem
I'm making a game that needs a day/night cycle and i created a script that just slowly turns the directional light by 0.5 degrees every couple of frames. I noticed that after a few minutes the game freezes for a few seconds or just crashes. Looking at the memory profiler I noticed that GfxDriver was constantly taking more and more memory and only stopped when i paused the game or disabled the rotation of the directional light. Below that, it says that every time the light moves, a new texture is created. Are those shadowmasks or something? Is there anyhing that can delete those old textures to free up memory? Resources.UnloadUnusedAssets();
doesn't help and neither does System.GC.Collect();
(found those two in the anwers from simmilar questions)
Info about the project(idk what here is useful, im still learning stuff):
Unity version 2019.3.5f1
HDRP 7.1.8
All lighting is set to realtime
8GB DDR4 RAM
Hi @Aleksandar204
I would really need to take a look at some code in order to assist you. I understand that updating to 2020 has helped alleviate the issue but please do post the code as this should not happen. I think that you may have some sort of the endless loop running somewhere that is causing the issue. It is extremely rare that you would want to call GC.Collect().
Here's the code that caused this:
void Update()
{
if(move > 10)
{
transform.rotation *= Quaternion.Euler(Vector3.right / 50);
move = 0;
}
move += Time.deltaTime * speed;
}
This is the only code attached to the directional light in question. I remember seeing the pachnotes for 2020.1 beta and I saw this: Graphics - General: AsyncGPUReadback.Request never releases unused allocated memory (1234193) so maybe this is what fixed it.
good find, I think you are correct =)
$$anonymous$$aybe post an answer to your own question and mark it correct so others can find it.
Answer by Aleksandar204 · May 30, 2020 at 09:39 AM
Problem is solved by upgrading to Unity version 2020.1b10 (or later). The bug in question was specified here
Your answer
Follow this Question
Related Questions
What is the correct way to store circular references in Unity? 1 Answer
Run out of memory in build 1 Answer
Memory usage increase when voxels deleted?! 0 Answers
Clear Color32[] array from memory? 0 Answers
OPEN WORLD GAME QUESTION 2 Answers