Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Can't unload Sprite Atlas from memory

Discussion in 'Asset Bundles' started by YibinZhang, Apr 23, 2022.

  1. YibinZhang

    YibinZhang

    Joined:
    Jan 21, 2022
    Posts:
    13
    I use Sprite Atlas to make several textures into one texture and generate Asset Bundle. Load sprite from AB and use it. After I unload Asset Bundle, texture is always one reference left by SpriteAtlasDataBase according to the profiler. Even I stop Play, this reference is still exist. So how can I unload a sprite atlas completely and correctly?
    I find one same problem. But no one find how to resolve this: Unload Sprite Atlas from memory - Unity Answers
     
    Last edited: Apr 23, 2022
  2. YibinZhang

    YibinZhang

    Joined:
    Jan 21, 2022
    Posts:
    13
  3. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    1,873
    Does this also happen when you build a Player in development mode and profile that? And what does the Memory Profiler package say about the elements in this reference chain? I expect some of these elements to be having some Editor Hide flags (in the Advanced section of the Selected Item Details section of the right hand side bar in the Memory Profiler package).

    Because as the Memory Profiler Module toolbar is trying to tell you, memory usage and behavior in the Editor is different to that in a build Player and I expect that's the case here.
     
  4. YibinZhang

    YibinZhang

    Joined:
    Jan 21, 2022
    Posts:
    13
    Thanks for your help. Today I tried to build a Player and profile that, this situation can't reproduce. So this is may only appear in Editor.
    Yesterday, I did't know Memory Profiles can capture from Player, not only in Editor. So I builded a Player, but get memory usage through Task Manager, after release sprite, the memory was not reduce. So I doubt this situation also exist in Player.
    I guess memory which reduce have been management by Unity after release sprite and will not request memory from system when load other texture. But I can't sure that because I can't find documents about this.
    Thank you again.
     
  5. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    1,873
    Yes:
    but I guess this point in the Memory Profiler Module Manual page is relatively subtle and there's also a whole lot of information to digest when you get into profiling for the first time. I'll keep it in mind for when we expand this section in the documentation and have another pass over the package's documentation.

    But for these more granular checks, the Memory Profiler (package or module) should be checked over system level observations.
     
  6. YibinZhang

    YibinZhang

    Joined:
    Jan 21, 2022
    Posts:
    13
    Get it, thanks. :D
     
    MartinTilo likes this.