Skip to content

[Unity] Bug: 可能存在的内存泄漏 #2032

Open
@dunadain

Description

@dunadain

前置阅读 | Pre-reading

Puer的版本 | Puer Version

2.2.0

Unity的版本 | Unity Version

2022

发生在哪个平台 | Platform

Editor(mac)

错误信息 | Error Message

在js里用addressable加载资源,虽然最后release了 handle,但从memory profiler看一直资源有个js引用没有消除。已经打开了 --expose-gc(但不知道操作是否正确),点了手动gc
补充:
看了代码貌似只有在非il2cpp才开启,所以不知道怎么去手动gc。

问题重现 | Bug reproduce

Test1.zip

加载的代码

let handle;
const asyncOperationStatus = CS.UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationStatus;    
handle = CS.AddressableHelper.LoadAudioClip('Assets/Audio/30000_hit.mp3');
let p = new Promise(resolve => {
   handle.add_Completed(handle => {
          if (handle.Status === asyncOperationStatus.Succeeded) resolve(handle.Result);
    });
});
p.then(result => {
      console.log(result);
      console.log('load complete');
});

Metadata

Metadata

Assignees

Labels

UnitybugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions