Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

Help Wanted The Allocated Memory increases depending of the number of scene in the build

Discussion in 'Editor & General Support' started by richicm99, Jan 8, 2021.

  1. richicm99

    richicm99

    Joined:
    Jan 31, 2019
    Posts:
    2
    Hello,


    We have a problem with the Allocated Memory in our game, this occurs in PC and PS4 builds.


    We have a menu as the first scene. In a build with only this scene, the Allocated Memory is 130 MB but the more scenes the build has, the more this memory increases (up to 1500 MB). Why is this happening?



    We have also implemented a script to gradually eliminate the art from the menu scene and as there were fewer assets, the Allocated was decreasing. What we do not understand is that it does not matter in what order we delete the assets, the memory decreases in the same way. It seems as if the assets have some kind of dependency on the rest of the project.


    We have realized that the Allocated Memory is not completely eliminated so when changing scenes it increases more and more, exceeding the capacity of the PlayStation 4.


    To go between scenes we do this:






    All this happens from the scene in which the build starts, no matter what. The Allocated of that scene will be higher as more scenes have the build.



    Right now we are in Unity version 2019.4.16 but we have also tested it with 2019.4.17 and 2020.2.1 and the problem persists.


    We need someone to help us find out what is the reason for this error and especially how to fix it.


    Thank you very much,
    Team Beluga.



    upload_2021-1-8_14-9-29.png
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    15,760
    The go-to source for memory consumption would be the profiler (Window -> Analysis -> Profiler).

    Where does it say your memory is being used?
     
  3. richicm99

    richicm99

    Joined:
    Jan 31, 2019
    Posts:
    2

    We've just discovered that deleting the lightmaps reduces the memory a lot (even though none of them are being used in that scene)

    It went from
     
    Last edited: Jan 8, 2021
unityunity