Unity 5 Lighting RAM Problem

I have found that using a light in Unity 5 with any type of shadow causes the Unity editor memory usage to skyrocket. I have tried turning shadows off, and my scene idles happily at about 130 MB of usage. If I turn shadows on, it increases at a rate of around 4 MB/s and doesn’t stop until the game becomes unplayable (it got above 1GB total ram usage). Is this a bug in Unity 5? Anyone know how I can resolve this issue?

I am using Unity 5.2.1f1 Personal edition.

Also, the memory usage stays high after I stop play, and doesn’t reset when I press play again; it just keeps adding.

Edit: I should mention I am on 64 bit Windows 10. GPU is Nvidia GTX770 using driver 355.83.

Sounds like a driver issues, not a unity thing.

Same problem here, on Unity 5.2.1f in Windows 7. Happens in editor and player. As long as there's a light source with shadows enabled, and some objects that cast shadows visible, memory usage keeps climbing.

Does this happen in a simple scene (e.g. a single cube)? Does the rate of memory consumption depend on the complexity of the scene? Dan Unity Support

Not resolve in 5.2.1p1. I've got the same problem. Hope it will be release in next release. There was not problem before 5.2 Tested on 3 differents computer with different graphic card, and I get the same problem

Man I've completely destroyed (a copy) of a scene trying to find the source of the problem and found the same thing. I was working all day yesterday and when Unity started lagging I saw it was using up to 10 gigs of ram. 64 bit, Windows 7, GTX670 and Unity 5.2.1p2 running on GeForce 355.98 drivers. I will try the newer 358.50 drivers this afternoon and see if it makes a difference.

2 Answers

2

You can check the issue ID 736709 in the Unity Issue Tracker:

Memory leak when shadows are turned on

Please, vote on this issue so it gets prioritized. I think it’s important, with big scenes this issue becomes quite critical.

I have the same exact problem, but it progresses to the point of the memory spiking to 100%, disk at 100%, and CPU at 98%, which is followed shortly thereafter by the screen not just going dark, but shutting off completely, even though the computer stays on. This cannot be fixed unless you reboot completely, which causes huge problems on startup of my computer.

Which version of Unity are you using? Bug 736709 was fixed in 5.3 and also in 5.2.2p2. Dan Unity Support