How to mange memory used by A-Frame?

若如初见. 提交于 2020-01-01 19:18:11

问题


I'm building a web app which has 360 degree images loaded into an a-sky primitive. I'm using aframe-react. There are total of 20+ 360 degree images and only one img asset inside a-assets. once user switches scene react will change src of asset img and scene will re render. Everything works fine but it's using lot of memory because of caching. One time it used 4GB+ memory. In mobile the web page crashes after switching through ~8+ images. How do I handle this situation?

I tried looking into THREE.Cache but images are not cached there.

Is this memory usage has anything to do with using React?


回答1:


There's an issue for A-Frame to automatically manage it, but right now have to hack around to clear textures.

AFRAME.scenes[0].systems.material.textureCache[url].then(function (texture) {
  texture.dispose();    
});


来源:https://stackoverflow.com/questions/43940665/how-to-mange-memory-used-by-a-frame

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!