Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug The system is running out of memory. Please close applications to free memory or free up space on th

Discussion in 'VR' started by eusebium, Feb 1, 2021.

  1. eusebium

    eusebium

    Joined:
    Jul 23, 2016
    Posts:
    84
    After a couple of times running the app in Oculus Link (especially!) from the Editor 2020.2 I get this memory message which requires to restart Unity:
    The system is running out of memory. Please close applications to free memory or free up space on the partition where the pagefile is located.
    Used memory (physical and paged): 94% (30828MB of 32724MB).
    Discarding profiler frames data.

    If I run the app without Oculus Link, I also get this error but after many runs.

    I disabled the Virtual Memory from Windows.

    Any ideas why this happens?
     
    Last edited: Feb 2, 2021
    dan_ginovker likes this.
  2. colinleet

    colinleet

    Joined:
    Nov 20, 2019
    Posts:
    188
    #1) The profiler is a massive memory hog.
    #2) This is a feature not a bug.

    Clear the profiler history when you're done with it, otherwise it's basically a active memory leak. (It's so you can dump it to disk for analysis later if you need to comb through the mass of data, or do stats analysis on it.)

    In particular click "Clean On Play" in the top of profiler widow to clear it automatically.
     
    Last edited: Feb 4, 2021
  3. eusebium

    eusebium

    Joined:
    Jul 23, 2016
    Posts:
    84
    No, that did not do it - issue still appears.
     
  4. msyoung2012

    msyoung2012

    Joined:
    Mar 20, 2014
    Posts:
    49
    I can confirm that using both "clear" and "clear on play" does not solve this issue.
     
    vedanti_mungekar likes this.
  5. NemesisWarlock

    NemesisWarlock

    Joined:
    Jan 21, 2017
    Posts:
    140
    Have you perhaps considered closing browser tabs/shutting down other programs? it sounds to me like it's less of a unity problem and more of a "you have too much stuff open" problem.
     
  6. msyoung2012

    msyoung2012

    Joined:
    Mar 20, 2014
    Posts:
    49
    Only application running was Unity in my case. Pretty frequent issue whenever the Profiler is running, and never happens when it's not.
     
  7. Cloudwalker_

    Cloudwalker_

    Joined:
    Jan 3, 2014
    Posts:
    140
    The unity editor is a memory hog. Better not disable virtual memory...
     
  8. colinleet

    colinleet

    Joined:
    Nov 20, 2019
    Posts:
    188
    Dude just give screen shots of your task manager next time this is a problem, or better yet do a memory capture using the unity memory profiler, or the normal profiler, to figure out what your memory hog (or leak) is on your own -- and then ask for detailed advice about how to fix it.

    Vague "memory overused" isn't giving us much of anything to work with.
     
  9. marvpaul

    marvpaul

    Joined:
    May 9, 2016
    Posts:
    32
    I'm facing the same problem (Unity 2020.3.0f1). Profiler does not work at all! Error:
    The system is running out of memory. Please close applications to free memory or free up space on the partition where the pagefile is located.
    Used memory (physical and paged): 40% (5735MB of 14336MB).
     
    dan_ginovker likes this.
  10. dan_ginovker

    dan_ginovker

    Joined:
    Jun 13, 2021
    Posts:
    76
    Randomly started happening to me as well after starting the profiler. Started happening to my teammate a few days later without him using the profiler. Even more strangely, we haven't merged our code yet so it can't be a new feature we added, simply a coincidence.

    The only other thing I have to add is we're both on M1 macs, Unity 2019. I updated the Unity Hub Beta 3.0.0-7 but he didn't..

    Edit: Seems to be happening to other people randomly as well: https://answers.unity.com/questions/1724939/unity-says-the-system-is-running-out-of-memory-whe.html
     
  11. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,431
    Hello Y'all,
    For Mac M1 chips we are now tracking this as a bug, case 1386242.
     
    galbenaim8, AlejMC, marvpaul and 3 others like this.
  12. AlejMC

    AlejMC

    Joined:
    Oct 15, 2013
    Posts:
    149
    Is there any temporary workaround?
    I'm afraid that the fixes will come at the farthest on 2021.2.x and currently can't risk going above 2021.1.28f1.

    Tried lowering the Frame Count of the profiler but it doesn't allow less than 300.
     
  13. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,431
    Non that I know of. 2021.1 is a tech release version that is no longer receiving updates so you should really not stay on that one. You will eventually have to update to 2021.2/3 and maybe stay on 2021.3 (the 2021 Long Term Support version) if you need to reduce your upgrade risk while maintaining access to fixes.

    That is unless you're not on 2021.1 yet but 2020.3. there is a backport planned for 2020.3
     
    AlejMC likes this.
  14. path14

    path14

    Joined:
    Apr 9, 2017
    Posts:
    113
    Hi, I'm using 2021.2.11f1 and I cannot use the profiler due to lack of memory:

    The system is running out of memory. Please close applications to free memory or free up space on the partition where the pagefile is located.
    Used memory (physical and paged): 48% (5416MB of 11264MB).

    I'm using a Macbook Air M1 2021.
     
  15. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,431
    The backport for the fix of case 1386242 has landed on 2021.2 and will become available with 2021.2.13f1.
     
    path14 likes this.
  16. nickfourtimes

    nickfourtimes

    Joined:
    Oct 13, 2010
    Posts:
    219
    I'm seeing this out-of-memory error on an M1 Mac Mini with deep profiling disabled. Is this a separate bug, or should I consider it the same?

    [Edit] I should also specify that this is while I'm profiling in-editor, in Play mode, rather than profiling a standalone process.
     
    Last edited: Feb 16, 2022
  17. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,431
    It's pretty likely to be the same and since the backports for the fix are ongoing, it's probably best to wait for those to land on an Editor Patch Release within the mayor version stream you're on and try to reproduce it in that version with the fix.
     
    Last edited: Feb 16, 2022
    nickfourtimes likes this.
  18. nickfourtimes

    nickfourtimes

    Joined:
    Oct 13, 2010
    Posts:
    219
    Yeah, I'm currently on U2021.2.9, I'll keep an eye out for .13
     
    MartinTilo likes this.
  19. nickfourtimes

    nickfourtimes

    Joined:
    Oct 13, 2010
    Posts:
    219
    Just to follow up: it looks like U2021.2.13 was released; and indeed, I can correctly connect to and profile on running devices.
     
    MartinTilo likes this.
  20. tatsuoNIA

    tatsuoNIA

    Joined:
    Aug 6, 2016
    Posts:
    2
    I use 2019.4.28f1 and am getting the same error for both normal and deep profile.
     
  21. tatsuoNIA

    tatsuoNIA

    Joined:
    Aug 6, 2016
    Posts:
    2
    I noticed this only happens when I start profiling with the "Hierarchy" mode. Switching it to Timeline resolved the issue for me.
     
  22. hieutran196

    hieutran196

    Joined:
    Dec 17, 2018
    Posts:
    21
    Still on M1, version 2021.2.17
     
  23. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,431
    That's odd, the original bug is verified to be fixed in 2021.2.13f1. Could you please file another bug for it via the Editor menu
    Help > Report a Bug
    ? There could be some case that's been missing from that fix but we'd need some context on to diagnose and fix. :)
     
  24. CGDever

    CGDever

    Joined:
    Dec 17, 2014
    Posts:
    156
    Unity 2021.3.0f1 :
    The system is running out of memory. Please close applications to free memory or free up space on the partition where the pagefile is located.
    Used memory (physical and paged): 93% (25028MB of 26761MB).
    Discarding profiler frames data.
     
  25. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,431
    That sounds close enough to memory pressure to be legit a reason to drop frames. We'd only ba able to fix this by changing the profiler data stream to be ring-buffered to disk instead of fully retained in RAM. We eventually want to do something like that, but that's a feature, not a bugfix.

    To work around this, you could close other applications, reduce the amount of retained frames in the Profiler Preferences, close Profiler Modules you don't need, only run deep Profiling when needed and e.g. to find GC Allocs use Allocation Call-stacks instead of deep profiling.
     
  26. hieutran196

    hieutran196

    Joined:
    Dec 17, 2018
    Posts:
    21
    I close tab Profiler, FrameDebug and issue was gone.
     
  27. Mia_white

    Mia_white

    Joined:
    Apr 15, 2022
    Posts:
    13
    i second this, doesnt work for me either
     
    msyoung2012 likes this.
  28. atomikm

    atomikm

    Joined:
    Feb 8, 2020
    Posts:
    20
    Currently on 2020.3.17f1 with an M1 Macbook and experiencing this issue. Any idea if a backport is planned for 2020.3 LTS?
     
  29. TreyH

    TreyH

    Joined:
    Feb 6, 2014
    Posts:
    15
    Has happened twice since Saturday with 2 clean installs of most recent 2021 LTS, pretty annoying.
     
  30. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,631
    2020 LTS is done, it's not getting any more updates.
     
  31. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,431
    Sorry about the way too late reply.

    In the comments to the original bug report it says it was backported to 2020.3.31f1

    I'm not sure if any follow up bug report was ever filed and fixed as if it did, I can't remember it reaching the profiler team (could have been on another team or I could've been on vacation?)

    So if it is an issue that was not fixed as part of the original fix then @AcidError is correct and a new backpoet won't happen anymore.

    So the same issue of it giving that warning even though there is still reasonably enough space in ram?

    As I said, I'm not aware of any further bug reports so it might express the same but be a new/sperate issue. If that is to ever be fixed, someone is going to have to file a bug report for it.
     
  32. TreyH

    TreyH

    Joined:
    Feb 6, 2014
    Posts:
    15
    Just noticed that this was originally a VR thread, which I am not doing.

    For the bug report stuff, I don't get the opportunity to submit it -- as it just slowly eats up more memory and the overall process could take 30+ minutes.

    For the actual issue popping up again, I left PC on overnight to re-index assets after a clean install, entered playmode for a few seconds, stopped playmode, and got this Gizmo message for (going on) 10+ minutes now:



    Once this happens, the editor hangs on that same cryptic gizmo message whenever I open the project, seemingly stuck halfway through drawing its windows.



    This has happened the last 3 times I've had a clean install and tried to just leave playmode, so I'm not sure what all is going on here.

    For the general bug report questions:
    - The issue is isolated to this project
    - A clean install editor install + version control backup does not fix it
    - No gizmo code has been changed or introduced lately

    Will leave the editor going like this until it hopefully dies and presents a bug submission form.

    Any help would be appreciated, thanks team. o7
     
  33. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,431
    You can start the bug reporter directly. Find it in your Unity Installation under e.g.
    C:\Program Files\Unity\2023.2.0a21\Editor\BugReporter\UnityBugReporter.exe


    It will typically automatically select the last Editor.log and Editor-prev.log file, and when started this way will likely need to be directed at the problematic project. If that project is too large to upload, you can also zip it up and write in the bug report that you would like to get a link where you can upload a larger file to it, and then upload it once you get a reply.

    This sounds like the issue is somewhere outside of the Assets or otherwise version controlled folders, like the Library folder. Once you have backed up a copy of the project (or at least the Library folder) for the bug report try deleting that folder.

    There are other folders outside of your version control that could be related, like some temp or caching folders (e.g. shader cache) but that seems less likely to be the issue here. If deleting library folder does not resolve it and while waiting for a response for the bug report, you could try attaching Visual Studio (or whatever IDE you use) and hit pause to see what it is executing. There's a chance that it's going to be native code or generally something with low visibility for you, but it might be a shot at getting a better understanding of where it is failing. The Editor log could maybe also help?
     
  34. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,431
    actually, on second though, gizmo drawing does relate to shaders so.... maybe it IS something broken in the shader cache?
     
  35. TreyH

    TreyH

    Joined:
    Feb 6, 2014
    Posts:
    15
    I've been clearing those out with each clean install, although I did try just now to manually delete the non-vc shader files and still got the hanging.

    The issue does seem to be with shaders though, as I could enter and leave the project without issue prior to adding the player's scene and viewing in the Game window. Afterwards, the Gizmo call hangs and Editor is unresponsive.

    Submitting a manual bug report now, thanks for the bug report exe path. o7
     
  36. TreyH

    TreyH

    Joined:
    Feb 6, 2014
    Posts:
    15
    Well I submitted the bug but found the issue 5 minutes later -- so pretty standard etc.

    The issue was that I have a trajectory visualizer that uses the Gizmos utilities to draw how something will behave at runtime. Part of that code includes something like this:

    Code (CSharp):
    1. var elapsed = 0f;
    2. var duration = projectileSpell.maxProjectileDuration;
    3.  
    4. while (elapsed < duration)
    5. {  
    6.     // Simulate Movement
    7.  
    8.     elapsed += Time.deltaTime;
    9. }
    Since I had never seen `Time.deltaTime` evaluate to exactly 0, this seemed fine. Indeed, googling "Can Time.deltaTime be zero" either tells you flat out that it cannot, or points to a situation where someone accidentally set their time scale to zero.

    In my case, it became zero for at least 4 situations:

    1. Loading a scene
    2. Entering Play Mode
    3. Pausing Play Mode (arguably expected?)
    4. Leaving Play Mode

    So if you are going to use `Time.deltaTime` in your Gizmos calls, be sure to check that your code isn't secretly assuming a non-zero dt.
     
    MartinTilo likes this.
  37. SoftwareGeezers

    SoftwareGeezers

    Joined:
    Jun 22, 2013
    Posts:
    902
    Just had this appear for the first time in 2022.3.1f1. Been running Unity for 30 minutes and on this play through, this error appeared. It appeared each subsequent play through. Memory use in Task Manager was 2 GB out of 16 GBs RAM. Nothing else running except a couple of browser windows. It was moaning about the pagefile. Plenty of space free on drive C.

    Restarted Unity and currently it's gone.
     
  38. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,431
  39. ceiline

    ceiline

    Joined:
    Dec 26, 2020
    Posts:
    3
    Hi, I'm encountering this same issue on 2019.04.35f1, my used memory is at 56%, M2 Mac - any chance anyone might have insight into this?
     
  40. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,431
    Have you looked at this with the Memory Profiler?
    You can take a snapshot in 2019 and open an empty project in 2022 with version 1.1 of the com.unity.memoryprofiler installed, import the snapshot and explore it there.