- Home /
Memory Leak in Play Mode
I use Unity 4.6 Beta for making my project. When I use it on Windows 7 32 bit (PC), I have no problems. But I need to work on my new laptop with Windows 8.1 64 bit, so I transferred the project (64 bit) there and I have a serious problem with memory. When I click Play, Unity slowly consumes more and more memory. It consumes almost 3 GB of memory ( I have 4 GB on my laptop). It lasts very long (an hour or more) to go into Play Mode. But it is happening only when I click Play for the first time, then it goes in Play Mode normally. When in Play Mode, the used memory is 500 MB memory only. It happens with all scenes in the project. My project is very big - about 80 GB.
I made an empty project and click Play. Unity goes into Play Mode quickly without problems. Is it possible that some of my assets makes this problem. And maybe the Unity Beta? But I don't experience that on my Windows 7 where I use the same project and the same Unity.
After having transferred the project to my laptop, I rebuilt (reimported)the project three times - no improvements. No problem when Unity isn't in Play Mode.
I wish to know if somebody has such a problem.
My computer details:
OS Name Microsoft Windows 8.1
System Manufacturer ASUSTeK COMPUTER INC.
System Model X551MA
System Type x64-based PC
Processor Intel(R) Pentium(R) CPU N3520 @ 2.16GHz, 2159 Mhz, 4 Core(s), 4 Logical Processor(s)
Name Intel(R) HD Graphics
80 GIGS OF DATA?
That's impressive. Unity always takes a bit extra time to go into play mode the first time after you start it, but this is a bit overkill.
EXACTLY! 80 GB of data. I have no problem on Windows 7 32 bit. Going into Play $$anonymous$$ode is much more quickly. When I start Unity and no in Play $$anonymous$$ode, Unity uses over 600 $$anonymous$$B of memory. As soon as i click Play, the memory is going up slowly. About 2 $$anonymous$$B per second. I am forced to wait until the memory will go to 2.7 or 2.8 GB to be in Play $$anonymous$$ode. It lasts a long time. I think the problem is in Windows 64 bit, because Unity is 32 bit, so there's time needed for translation. But it's too long. I don't know maybe the stable Unity 3D 4.6 will be faster. i hope Unity 5.0 64 bit will solve all such problems.
Now Unity is going into Play $$anonymous$$ode in 35 $$anonymous$$utes and with 2.2 GB of memory. It's still too long I think.
It's pretty hard to say if this is a bug in Unity or if it is one of your assets as we don't have any information from you except that your project is 80 GB big.
I'm not sure I understand you correctly. Is Unity using up that much memory before Play mode starts and once Play mode is actually done loading the memory gets freed?
What kind of assets are you using that your project is so big? Are your models fbx files? Do you have modeling software on your PC but not on your laptop or to make the question more general: Do you have the exact same software on your laptop and your pc installed?
If the memory goes down after Play mode starts then I don't think that this is a memory leak but ins$$anonymous$$d Unity is importing some of your assets or recompiling the code or whatever. Especially because you said that the memory usage goes up by around 2$$anonymous$$B/sec which might be the speed your harddrive is loading the data into memory.
You would need to profile the editor somehow to know where the memory usage comes from but I don't know if that is possible. You might want to ask the Unity tech support.
Answer by Asthegor · Oct 25, 2014 at 06:39 AM
The first thing to do is : remove all resources useless !!! Like materials, textures, sounds, ...
Another thing : if you use the OnGui function, move all coord calc to the Start function for static buttons/labels/etc...
Thanks for your answer.
I use New GUI, so there's no OnGUI functions.
I know I can remove all useless resources, but the problem is that my project works well on PC (Windows 7) with all resources. I am building a big and complicated project so I need a lot of those materials, textures, sounds,...
I think useless resources are removed by Unity and only those on the current scene are used in Play $$anonymous$$ode.
Your answer
Follow this Question
Related Questions
Question About Camera's, Canvases and Memory 0 Answers
"Real Memory" usage in iOS expands the more often one prefab is referenced in the assetbundle 0 Answers
"Memory profiling" Menu missing under windows menu. (5.3.8F1) 0 Answers
Sub-emitter memory leak? 3 Answers
Unity using too much memory on mac 0 Answers