Hi, it’s time for a little “Up”.
@Boof I tried to replicate the bug with Unity 2022.3.4f1 and I can confirm that it does not occur! That is a great news! Thank you for sharing
@ThomasZeng do you have any update on your side ?
Thanks,
Hi, it’s time for a little “Up”.
@Boof I tried to replicate the bug with Unity 2022.3.4f1 and I can confirm that it does not occur! That is a great news! Thank you for sharing
@ThomasZeng do you have any update on your side ?
Thanks,
Have you checked both DirectX 11 and DirectX 12? I’ve removed the second camera altogether. Now I draw pixels into runtime-generated textures directly from code for my minimap.
Gratefully! It seems to have been fixed for version 2022.3.8f1!
I had this problem with the 2022.3.5f1 version on my quest2, but found it fixed on the new version 2022.3.8f1.
(I also tried to upgrade to the 2023.1.8f version but it still seems to be there.)
Hi all,
Sorry for the late update .
There are three issues in this space that I am aware of:
The first issue fix (Editor performance drops) has landed to trunk and backported to 22.3 and 23.2.
The second issue fix(RenderTexture leak issue) has landed to trunk and backported to 22.3(not released yet) and 23.2(not released yet). This fix will be included in the next 22.3 and 23.2 release. (discussed more in this forum thread)
The third issue (RTHandle causes GC.Alloc) we believe it is a dup of the first issue. Our QA is validating that issue internally but we are likely gonna to close it as duplicate.
Hope this helps,
Thomas
Out of curiosity, has anyone had issues with camera stacking along with rendering to textures?
I recently was working on adding a 3D skybox to my camera via a base camera and an overlay camera. Everything seemed to be working fine until I re-enabled the objects that were being rendered to a render texture. Then the overlay camera stopped working and I’m getting null-reference errors from within the URP pipeline itself. I don’t have access to the project atm but I can post the error trace later.
So if I have a scene with three camera, one an overlay, one a base that will stack with the overlay, and another base that renders to a RenderTexture I get this null-reference error in the render pipeline.
NullReferenceException: Object reference not set to an instance of an object
UnityEngine.Rendering.Universal.UniversalRenderPipeline.CheckPostProcessForDepth () (at Library/PackageCache/com.unity.render-pipelines.universal@14.0.7/Runtime/UniversalRenderPipeline.cs:979)
UnityEngine.Rendering.Universal.UniversalRenderPipeline.RenderCameraStack (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera baseCamera) (at Library/PackageCache/com.unity.render-pipelines.universal@14.0.7/Runtime/UniversalRenderPipeline.cs:746)
UnityEngine.Rendering.Universal.UniversalRenderPipeline.Render (UnityEngine.Rendering.ScriptableRenderContext renderContext, System.Collections.Generic.List`1[T] cameras) (at Library/PackageCache/com.unity.render-pipelines.universal@14.0.7/Runtime/UniversalRenderPipeline.cs:362)
UnityEngine.Rendering.RenderPipeline.InternalRender (UnityEngine.Rendering.ScriptableRenderContext context, System.Collections.Generic.List`1[T] cameras) (at <6c9b376c3fca40b787e8c1a2133bf243>:0)
UnityEngine.Rendering.RenderPipelineManager.DoRenderLoop_Internal (UnityEngine.Rendering.RenderPipelineAsset pipe, System.IntPtr loopPtr, UnityEngine.Object renderRequest, Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle safety) (at <6c9b376c3fca40b787e8c1a2133bf243>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
The error ceases if I change the overlay camera to a base camera. However I do get the following error once. It doesn’t appear to break anything and only happens once but still annoying nonetheless.
NullReferenceException: Object reference not set to an instance of an object
UnityEngine.Rendering.VolumeManager.ReplaceData (UnityEngine.Rendering.VolumeStack stack) (at ./Library/PackageCache/com.unity.render-pipelines.core@14.0.7/Runtime/Volume/VolumeManager.cs:334)
UnityEngine.Rendering.VolumeManager.Update (UnityEngine.Rendering.VolumeStack stack, UnityEngine.Transform trigger, UnityEngine.LayerMask layerMask) (at ./Library/PackageCache/com.unity.render-pipelines.core@14.0.7/Runtime/Volume/VolumeManager.cs:438)
UnityEngine.Rendering.Universal.CameraExtensions.UpdateVolumeStack (UnityEngine.Camera camera, UnityEngine.Rendering.Universal.UniversalAdditionalCameraData cameraData) (at Library/PackageCache/com.unity.render-pipelines.universal@14.0.7/Runtime/UniversalAdditionalCameraData.cs:217)
UnityEngine.Rendering.Universal.UniversalRenderPipeline.UpdateVolumeFramework (UnityEngine.Camera camera, UnityEngine.Rendering.Universal.UniversalAdditionalCameraData additionalCameraData) (at Library/PackageCache/com.unity.render-pipelines.universal@14.0.7/Runtime/UniversalRenderPipeline.cs:941)
UnityEngine.Rendering.Universal.UniversalRenderPipeline.RenderCameraStack (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera baseCamera) (at Library/PackageCache/com.unity.render-pipelines.universal@14.0.7/Runtime/UniversalRenderPipeline.cs:784)
UnityEngine.Rendering.Universal.UniversalRenderPipeline.Render (UnityEngine.Rendering.ScriptableRenderContext renderContext, System.Collections.Generic.List`1[T] cameras) (at Library/PackageCache/com.unity.render-pipelines.universal@14.0.7/Runtime/UniversalRenderPipeline.cs:362)
UnityEngine.Rendering.RenderPipeline.InternalRender (UnityEngine.Rendering.ScriptableRenderContext context, System.Collections.Generic.List`1[T] cameras) (at <6c9b376c3fca40b787e8c1a2133bf243>:0)
UnityEngine.Rendering.RenderPipelineManager.DoRenderLoop_Internal (UnityEngine.Rendering.RenderPipelineAsset pipe, System.IntPtr loopPtr, UnityEngine.Object renderRequest, Unity.Collections.LowLevel.Unsafe.A
This was tried with Unity 2022.3.0f using the URP pipeline. Each camera had a different pipeline asset. Post processing was disabled on all pipeline assets.
Just to clarify, it appears that upgrading to 2022.3.9f fixed the issues. Thanks for that!
Since updating my project to 2022.3.3f1 and then going through 4, 7, 8 and 9f1 (facing Canvas bugs too) I’ve been having memory leaks that happen when Depth and Opaque textures are enabled and the scene is rendering, doesn’t matter if it’s in Play mode or not. If I close the Scene and Game windows, the leak stops.
I also tried starting a new project using URP template, copied my assets and the issue is still there.
Can this be related?
Edit: Some notes, the memory leak happens when Unity is in the background, looking at task manager makes it leak for example, if you are inside the Unity it doesn’t leak. It also seems like this only happens when the platform is set to Android, I am now trying with WebGL and there are no leaks, also when I tested on a new project, there was no leak until I switched platform to Android.
Exactly the same problem here but with windows build. I’m using unity 2022.3.8f1.
After updating the project to 2022.3.9 from 2022.3.5 the project started to leak also. Closing and reopening both the scene and game views stopped the leak.
Same here with 2022.3.9f1, currently downgrading to see if that resolves it. Let’s hope the fixes Thomas is talking about will work for us.
Just downgraded to 2022.3.7f1 and indeed there’s no more massive memory leak (mine was able to fill up ~64Gb of RAM in about a minute). At least I can continue working now
If your particular leak disappears in 2022.3.7f1 but is present in 2022.3.8 and 2022.3.9 then it could be this: https://discussions.unity.com/t/927815
After updating to unity 2022.3.10f1 I still seem to be getting an issue that looks like it’s tied to a camera render texture.
If I remove the camera with the render texture the error goes away.
The error I am now getting is
[Assert] Assertion failed on expression: ‘rs && rs->m_Texture && rs->m_SRView’'.
This is inside a play mode unit test. Anyone else experiencing an issue like this after the upgrade to 2022.3.10f1?
My issue is only occuring when targeting Android.
@Anibaaal it looks like we might be having the same issue. Did updating work for you by chance?
@Meatloaf4 While I don’t have a complete picture of what bugs have been reported and fixed, I do feel like most known leaks/issues in this rough area have been fixed so it would be super awesome if you could please file a bug report for what you’re seeing here, so that too can get fixed
I would definitely file a bug report but currently it looks to only be occuring on a unity Cloud Build during unit testing.
I think the likely cause is the low system specs on the build runners as I’ve tried to reproduce locally but I am unable to.
Do you have any advice on how I might go about filing a bug report given the nature of how the bug manifests?
With all this said, the bug does occur every time on build in cloud build so in theory is easily reproducible for my project.
After upgrading Unity to version 2022.3.10f1, in our project, in any scene (including an empty one), if the application is left idle for a while, the memory usage will increase extremely rapidly and consume the entire machine’s memory in 20 seconds.
This issue only occurs on Android devices and has an extremely unpredictable frequency, being more likely to occur after a fresh installation of the application.
However, if it connected Unity’s Profiler during the idle period, this issue does not occur.
This issue is extremely perplexing but has a significant impact. I’ve been attempting to resolve it for a month now, but have been unable to identify the root cause.
I’ve noticed a certain correlation between this abnormal memory surge and RenderFeature. The probability of encountering this problem decreases when a few RenderFeatures are removed, and it appears to be closely tied to the Universal Render Pipeline (URP). We did not encounter this issue with the previous 2021 LTS version that we were using.
That Assert is D311 gfx backend related, are you using a different one on your machine?
Hmm no idea but maybe with the log from cloud build?
Hmm, perplexing indeed.
Q: Did you delete the library folder after upgrading?
A: Yes, I’ve already try delete all library folder to rerun project and rebuild, it happened again.
Q: Do you get any logs in the Player logs or logcat when this happens?
A: I cannot found any valuable information from logcat, But I can upload a log for you.
Q: Which Unity version did you upgrade from?
A: I upgrade from unity 2021.3.9f1, ecs 0.51 and urp12, to 2022.3.3f1, urp 14.0.8 and ecs 1.0.16. I even try 2022.3.7f1, 2022.3.10f1, 2022.3.11f1, but all versions have that bug.
Q: Which RenderFeatures does it seem to be connected to?
A: Like Render Objects RenderFeature from urp, and some custom renderfeatures, like: outline, radial blur etc, But I found even I just only use Render Objects RenderFeature, that bug would happen.
Q: Does this also happen in a non-development player?
A: Yes, It even occurs in release package.
After a few days, I found some new informations. because we use com.entities.graphics 1.0.16 library, Maybe it’s bug from that? I’m not sure, but if I remove it totally, this problem disappear.
And if I set total job queue equals 1, the probability of the bug occurring is pretty low.
Because this bug appears randomly, I’m not particularly confident in the inference above. I have uploaded the adb logs from when the issue occurred, hoping it can be of help to you. Thank you for your assistance.
Thanks for the additional info @zhust2003
This sounds like a separate and new issue (or maybe just a different expression of it but without a repro project it’s impossible to tell) so we need to do a full analysis of it. Could you please file a bug report via the Editor menu Help > Report a Bug
?
Is this fixed