Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Question Is it...normal for Unity to use an increasing amount of memory as long as I leave it open?

Discussion in 'Editor & General Support' started by LuckyDucky12, Jun 26, 2020.

  1. LuckyDucky12

    LuckyDucky12

    Joined:
    Feb 5, 2016
    Posts:
    16
    I'll post this on Unity 3D's subreddit, too.

    So, I notice that my Unity seems to be eating my memory up. I don't really know what else to say, besides the fact that it needs more and more memory (AND CAUSES MORE LAG) the more I use it. This doesn't happen on my old laptop, but does on my new one and my Gaming PC.

    I think its an AMD issue, since both my new laptop and gaming PC have AMD CPUs.

    The Laptop has an AMD A4-5000 APU with Radeon HD graphics, and the PC has an AMD Athlon II X4 630 processor. The old laptop has an Intel Celeron CPU

    Don't know if that matters, but I might as well list it.

    Lastly, I noticed that the memory issue happens when I'm moving around a scene. I'm testing it in a completely empty scene, and when I move the editor, more memory is taken up and I lag more as a result. And that this is happening in Unity 2019.3.7f1. HOWEVER, The same thing happened when I installed Unity 2019.3.15f1 the other LTS versions of unity (All of them. I've tried them all). Eventually, this will lead to Unity crashing, so there's no point to fight through it.

    Again, this doesn't happen on my old and objectively weaker laptop. Only the ones with AMD CPUs.

    This is killing me; I'm trying to make a mobile Shock style game, and I KNOW i'd be done the demo by now, singlehandedly, if this lag wasn't a thing.

    TL;DR: I've ran Unity on three computers. The memory eating issue seems to occur on my pc and laptop with AMD CPUs. In 2019.3.7f1, 2019.3.15f1 and all the LTS versions (seriously). It happens until Unity crashes.
     
    Last edited: Jun 26, 2020
    PraetorBlue likes this.
  2. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,120
    Generally not. I'd recommend submitting a bug report with this project. It's possible you've found a memory leak.

    However, I'd start by profiling things first. Open the profiler, choose Profile Editor, and make sure that Memory is being included in the profiling. Then see if the memory usage climbs. You should be able to see what's contributing to the memory usage. That might more strongly indicate a leak in Unity's code, or possibly a problem in your own code.
     
  3. LuckyDucky12

    LuckyDucky12

    Joined:
    Feb 5, 2016
    Posts:
    16
    I don't think the issue is my code since I don't have this issue on my older laptop. Plus, I opened a completely blank Unity project, and I'm having the same issue with it. I did run the profiler, though, but I don't know where to upload the data file I just saved.
     
  4. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,120
    I'd definitely try to submit a bug report if this is happening on an empty project. Have you identified whether it's one particular system that keeps growing?

    If you click somewhere in the Memory graph. you can click "Take Sample Editor" to capture the size of various objects:

    upload_2020-6-26_22-56-32.png

    I'd be curious, if you did this twice a few minutes apart, if you see one item grow significantly in size between captures. You can then submit a bug report including the data. Note, though, that these profiler sessions can be huge, so it might be tricky to upload it with your bug report. I'm not sure, in that case, if it's better to put the file on some public server (dropbox, Google Drive) and just send the link with your bug report.
     
    MartinTilo likes this.
  5. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,164
    Hi :)

    First of, my apologies that you've hit a snag with this issue and thank you for already having checked a bunch of things, trying to narrow it down.

    With this happening with an empty project and across unity versions, it does indeed sound as though this would be a bug in Unity that would possibly relate to specific hardware, even though I have a hard time imagining what that could be (but stranger things have happened).

    So, yes, please report a bug. Ideally using such an empty project on a machine that had the issue, once to profile it, saving out some profiler data (the Profiler Window would not safe your memory snapshots, more to that below). Once without the Profiler (to isolate that it isn't the profilers Memory usage, though in 2019.4+ it should no longer cause any out-of-memory crashes) to let it run until it crashes. Then use the crash message to report a bug. If that's not possible, open the project again and report via Help->Report a bug.

    Doing it this way ensures we get some info on your hardware, editor and crash logs, and possibly editor and crash logs from the last session.

    Please also report as much detail as you can about the hardware of the machines that exhibit this behavior, and the one that doesn't, to help narrow it down and make it easier to find the hardware set that can reproduce it.

    To get memory snapshots that you can upload with the bug, you can use the Memory Profiler package. As @dgoyette suggested taking two memory snapshots with some time appart to see the difference can also help, this package also allows you to open them both and checking the difference between them via the diff button, which could help you and/or us it to narrow it down further.

    Lastly, the profiler data files might be huge but can often be compressed rather well, so zipping them could be something to try to keep the upload size small :)

    P.S.: Some other things to possibly consider for finding the cause, if it is indeed hardware related, could be to check if there is some difference in the amount RAM, VRAM, display resolution or maybe even hardrive (SSD vs not SSD)?