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

Textures - system RAM vs GPU RAM

Discussion in 'General Graphics' started by mariusgeorge, Mar 17, 2020.

  1. mariusgeorge

    mariusgeorge

    Joined:
    Jan 29, 2016
    Posts:
    18
    It's surprisingly hard to find a simple answer on this one :)

    Does Unity permanently keep full copies of texture data in system RAM, or will it clear system RAM once textures are uploaded to GPU RAM?

    I wonder - because looking at the new memory profiler snapshots, it seems that large amounts of system RAM is being taken up by textures - but why? If the texture data is pushed to GPU, should Unity not free up all the system RAM straight away?

    Context: mainly I'm referring to Windows standalone builds with your typical nVideo GPU (GeForce), etc. with about 3GB+ of GPU RAM. In my case, a 1060 with 6GB.
     
    Last edited: Mar 17, 2020
  2. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,432
    The Memory Profiler doesn't currently know if the memory is located on the CPU or the GPU but will report it either way. If any texture seems to be taking double the space it should, it's probably retained on the CPU after uploading to the GPU. Possible reasons for that are that it is marked as Read/Write enabled, in which case a version has to stick around on the CPU to provide that access.
     
  3. mariusgeorge

    mariusgeorge

    Joined:
    Jan 29, 2016
    Posts:
    18
    Thanks for the quick response. Do you have plans to make this distinction in the future? I'm tasked with trying to reduce system RAM usage (less worried about GPU RAM), but with no way of knowing from the memory profiler snapshot if it is system RAM vs. GPU RAM that is taken up by a given native object (Texture2D, audio clip, etc.), it can be pretty hard to focus in on the right area.
     
  4. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,432
    Yes but no ETA and it'd be something that comes with a newer Unity version, not only needing an update to the package, since that'd be a backend change.
     
    mariusgeorge likes this.