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

关于使用您的工具的两个问题想请教下 #3

Open
funnydavid opened this issue Mar 11, 2017 · 0 comments
Open

关于使用您的工具的两个问题想请教下 #3

funnydavid opened this issue Mar 11, 2017 · 0 comments

Comments

@funnydavid
Copy link

您好,首先非常感谢您开源这份代码给大家,我们的项目基于您的工具进行初始框架的搭建,节省了不少时间,向您的共享精神表示感谢~~
我们目前遇到了一个问题,主要是在AssetBundle的加载中,而我们自己修改了部分ResourceModule代码,因此不确定是框架内本身带有的问题还是我们自己改出的问题,所以我尽力描述一下,不知道以您的经验是否能够提供一些帮助(我们自己已经查了1周多时间了。。。)

主要问题出现在KAssetFileLoader中,我加log来看,我们使用InstanceAssetLoader来加载一个资源,它使用AssetFileLoader来加载,进而使用AssetBundleLoader加载AB文件,我们发现某些时候出现某个资源的AssetFileLoader被销毁,而AssetBundleLoader并没有被销毁的情况,这时候由于AssetFileLoader中的第236行
Object.DestroyImmediate(ResultObject as Object, true);
之后再用这一个AssetBundleLoader来加载AB,就会报错,触发AssetFileLoader中第136行或者第145行的Assert。

我仔细跟了一下GC的过程,感觉有一个小问题,比如一个InstanceAssetLoader被清理时,它使用的AssetFileLoader才会被release掉,这时候并不会立即GC,而是等待下一个GC周期,比如几秒之后,才会清理AssetFileLoader,进而AssetFileLoader的引用计数才会标记为0,等待下一个GC周期的清理。

我不知道对于您这边GC的设计是否理解正确,我自己也不太理解为什么Object.DestroyImmediate(ResultObject as Object, true);这句话会导致一个被复活的AssetBundleLoader加载资源失败,不知道您能否给些建议或者指导?

再次感谢~~

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