Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLua的GetAlreadyDestroyedObjectNames #326

Open
BAJIAObujie opened this issue Aug 8, 2022 · 0 comments
Open

SLua的GetAlreadyDestroyedObjectNames #326

BAJIAObujie opened this issue Aug 8, 2022 · 0 comments

Comments

@BAJIAObujie
Copy link

BAJIAObujie commented Aug 8, 2022

SLuaForUnity有这么一段代码用于检查内存泄漏。但是有点疑问:
第一是从objMap.Keys拿出来的o已经是System.Object类型,为什么在之后的if判断中还要重复转为System.Object类型。因为在IDE里查看if语句里的Object也是System.Object类型。
第二是,已经为null的o,还可以作为key去字典里查找么?

public static List GetAlreadyDestroyedObjectNames(){
List names = new List();
foreach(var cache in multiState.Values){
foreach(var o in cache.objMap.Keys){
if(o is Object &&(o as Object).Equals(null)){
names.Add(cache.objNameDebugs[o]);
}
}
}
return names;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant