Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Large chunk of Memory used by a single "TempBuffer" <RenderTexture>?

Discussion in 'Image Effects' started by hoperin, Jun 18, 2019.

  1. hoperin


    Feb 9, 2014
    So, I'm trying to track down what is causing/creating a single huge <RenderTexture> that doesnt change -- stays at 161.5 MB no matter what, that I found through memory profiling.

    All my research so far points to it being caused by post-processing? The Best Practises page only talks briefly about renderTextures, but elsewhere I've seen a lot about having to load and then unload RenderTextures, or else they will stay in memory, but I definitely haven't been doing any RenderTexture loading.

    Code (CSharp):
    1. That TempBuffer is a Temporary Rendertexture rendered at 256x256, probably created by some PostFX (or your Water System?)
    2. Search your codebase for RenderTexture.GetTemporary and check that the created RenderTexture get's cleaned up with RenderTexture.ReleaseTemporary.
    from this thread

    That doesnt seem to be the problem, as far as I can tell, though.

    I do have a single post-processing effect on my pause screen to do a depth of field blur, but at the point of taking this snapshot that hasn't been opened, this is only a few seconds in to the first scene.

    I know this is a pretty open-ended question but I don't know where to even start looking to fix this -- is it caused by post-processing, or is there something else that creates <RenderTexture>?

    Memory tree:

    Raw data details:
  2. AlexHell


    Oct 2, 2014
    In my project WITHOUT PostProcessingStack - also exist TempBuffer
    (1280x720 as screen size of unity on PC)
    I mean it doesn't related to PostProcessingStack, but may be built-in (only this single instance of screen size, not all of RenderTexture.GetTemporary)
    Last edited: Jul 5, 2019
  3. cLick1338


    Feb 23, 2017
    Use the frame debugger (scrub through and keep an eye on the Render Target), you'll most likely spot where that texture comes into play. I don't have any more answers as I'm dealing with an issue similar to yours right now.

    Edit: I think my issue was caused by excessive MSAA
    Last edited: Jul 10, 2019
  4. pistoleta


    Sep 14, 2017
    @AlexHell , @hoperin Did you find how to get rid of this ?