Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Feedback URP native memory leaks

Discussion in 'Unity 6 Beta' started by Peter77, Mar 16, 2024.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,639
    It seems URP leaks memory. I have created a windows player with 6000.0.0b11 and started it with
    -native-leak-detection EnabledWithStackTrace
    and it found:

    "Leak Detected : Persistent allocates 720 individual allocations"

    I have attached a text file with the stacktrace of two leaks. Is this a known issue?
     

    Attached Files:

  2. Jonathan-Westfall-8Bits

    Jonathan-Westfall-8Bits

    Joined:
    Sep 17, 2013
    Posts:
    300
    What settings do you have for your build player and your graphics renderer asset out of curiosity? Main reason for asking, I noticed these are in the library/bee/artifacts folder out of all things.
     
  3. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,639
    upload_2024-3-17_14-0-14.png

    upload_2024-3-17_14-0-51.png

    upload_2024-3-17_14-2-1.png
     
  4. Jonathan-Westfall-8Bits

    Jonathan-Westfall-8Bits

    Joined:
    Sep 17, 2013
    Posts:
    300
    I got a project that I use for testing purposes for 3D URP. Going to try out some of these settings and see if I can find it. Due to how each project differs from use to use I might not end up running into the same feature you use that is causing the memory leak, but worth a shot.
     
  5. Jonathan-Westfall-8Bits

    Jonathan-Westfall-8Bits

    Joined:
    Sep 17, 2013
    Posts:
    300
    Okay so within a few minutes of the last post I created a new project for a clean debugging environment and noticed something. I am assuming you should have the Collections Package installed as a dependency of URP 17.0.2.

    Try installing Collections 2.4.0-pre.5 if it will let you. For URP version 17.0.2 it has 2.4.0-pre.2 installed as default, but there was a memory leak in that version of the package that was already fixed. This might be your leak issue because in the leak text file, it has logs about the Collections package in the ilcppOutput call for Unity.Collections.cpp.

    Edit: Release notes talking about the memory leak I am mentioning you might be effected by
    https://docs.unity3d.com/Packages/com.unity.collections@2.4/changelog/CHANGELOG.html
     
    Peter77 likes this.
  6. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,639
    Yes, I have 2.4.0-pre.2 installed. However, Unity doesn't seem to allow me to change it. I have tried to update via Package Manager (I have experimental packages enabled, but no update is visible) and by changing it to 2.4.0-pre.5 in packages-lock.json, but Unity is always reverting it.
     
  7. Jonathan-Westfall-8Bits

    Jonathan-Westfall-8Bits

    Joined:
    Sep 17, 2013
    Posts:
    300
    I installed the new version by name in the package manager window and got it to work. Is there an error or warning in the Unity console about not being able to update a package directory. A couple weeks ago I had to clear my package manager cache and the package cache folder to update a package in Unity 6 Beta. Not sure if you are running into the same issue I ran into. I know it was fixed after clearing the package cache once though.

    For the setting when it asks for which package to install I used.

    Name: com.unity.collections
    Version: 2.4.0-pre.5
     

    Attached Files:

    Peter77 likes this.
  8. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,639
    Thank you for your answer.

    I didn't know this button until just now. That one worked to install the updated package :) Unfortunately, the leaks are still there.