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

Scene Unload operations not being cleared

Discussion in 'Addressables' started by JakubTrailmix, Oct 23, 2019.

  1. JakubTrailmix

    JakubTrailmix

    Joined:
    Jun 1, 2018
    Posts:
    17
    Hi there, I've been integrating the Addressables system to out content management and loading system and I've noticed a worrying pattern when I've started using the Load and Unload scene mechanic.

    Our system works by creating load tasks for all items we might need in a given scenario, then processing loading and displaying the given content. When we're done we unload all of the items.
    We don't have any issues with regular assets loaded trough Addressables, they get nicely cleared out at the end.
    With the scenes though, for each loaded scene that gets unloaded, we get a leftover handle in the Addressable Profiler
    UnityEngine/ResourceManagement.ResourceProviders.SceneProvider+UnloadSceneOp, result'', status='None'
    .

    This also stays in the profiler when loading a scene with LoadMethod.Single to unload all previously loaded scenes.

    Is there a way to properly cleaned up? Or am I doing something wrong?

    Regards,
    Jakub
     
    RunninglVlan likes this.
  2. RunninglVlan

    RunninglVlan

    Joined:
    Nov 6, 2018
    Posts:
    182
    Confirming this on my end too with Addressables v1.3.8 (and Unity v2019.3.0b8)
    upload_2019-11-8_13-28-7.png
     
    Last edited: Nov 8, 2019
  3. KAJed

    KAJed

    Joined:
    Mar 15, 2013
    Posts:
    122
    Ditto
     
  4. Jribs

    Jribs

    Joined:
    Jun 10, 2014
    Posts:
    154
    Yeah there has been a few posts about this issue, I dont think any of them have gotten a response from a unity person yet.
     
  5. techmage

    techmage

    Joined:
    Oct 31, 2009
    Posts:
    2,133
    Ya I have this issue too. Whats going on?
     
  6. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    As of 1.2.2 there is a parameter in the UnloadScenes call that can optionally make these operations auto-unload...


    public static AsyncOperationHandle<SceneInstance> UnloadSceneAsync(SceneInstance scene, bool autoReleaseHandle = true)


    Are you calling that with false? Or calling it with true (or default) and it still never goes away? Or perhaps you are using a version older than 1.2.2?
     
  7. Jribs

    Jribs

    Joined:
    Jun 10, 2014
    Posts:
    154
    @unity_bill I am on 1.3.8 and I have tried it with both true and false and it has the same effect.

    When using false I even attempted to manually call Release on the handle and again, same result.

    Correct me if I'm wrong but it seems like that autorelease actually releases the previously loaded scene using LoadSceneAsync. It doesn't seem to release the actual UnloadSceneAsync handle. I don't really know how that works, is it supposed to release both?
     
  8. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    We'll look into it. If you could file a ticket against Unity with a repro case, that would help.
     
    naby7u likes this.
  9. techmage

    techmage

    Joined:
    Oct 31, 2009
    Posts:
    2,133
    I am on the latest addressable and autoReleaseHandle is set, but it still has the issue.
     
  10. cg-adam

    cg-adam

    Joined:
    Jul 30, 2019
    Posts:
    44
    We are seeing this as well.
     
  11. techmage

    techmage

    Joined:
    Oct 31, 2009
    Posts:
    2,133
    Just upgraded to 1.5.0 and it still shows this?

    Am getting close to release, am worried is this a real memory leak?

     
  12. Jribs

    Jribs

    Joined:
    Jun 10, 2014
    Posts:
    154
    @techmage I've done pretty extensive memory testing with this issue and it doesn't seem to affect much. If there is a memory leak, its suuuuper slow and will take thousands of unloads to cause any issues.
     
  13. EduardDraude

    EduardDraude

    Joined:
    Mar 8, 2019
    Posts:
    60
    Any updates on this issue? Because I also noticed the unreleased unload operation.
     
  14. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    762
    This should hopefully be fixed in 1.6.3. If you're still having trouble let me know.
     
  15. cg-adam

    cg-adam

    Joined:
    Jul 30, 2019
    Posts:
    44
    1.6.2 seems to be the latest available?
     
  16. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    762
    @cg-adam sorry, yes 1.6.3 isn't out just yet but should be soon.
     
    EduardDraude likes this.