App crashes because of memory leakage while using .glb objects -> how to release the graphical memory allocated for the .glb based virtual objects #216
Replies: 7 comments 10 replies
-
I found SceneView.destroyAllResources(); as one command that originally gets into the renderer.java class of the sceneform library. In the code bellow you see that two functions are called: ResourceManager.getInstance().destroyAllResources(); and EngineInstance.destroyEngine(); public static void destroyAllResources() {
EngineInstance.destroyEngine(); } public void destroyAllResources() { |
Beta Was this translation helpful? Give feedback.
-
Hi, |
Beta Was this translation helpful? Give feedback.
-
You are using the 1.16 while we are currently on 1.20.1 !!!! A lot of work has been made on the memory issues since the Google version |
Beta Was this translation helpful? Give feedback.
-
Hello,
Oh, really! I didn’t know about the new version.
Could you please send me the link for the recent version? I hope this would solve the problem.
Thanks,
Niloofar
…Sent from my iPhone
On Nov 29, 2021, at 12:00, Thomas Gorisse ***@***.***> wrote:
You are using 1.16 while we are currently on 1.20.1 !!!!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
-
Here is the correct way to clean nodes: |
Beta Was this translation helpful? Give feedback.
-
@Niloofar-didar Did you make any progress on this? I'm experiencing issues with memory leak as well in my application. I'm calling all sorts of methods in my onDestroy handler like this and still no effect on my memory usage: public void onDestroy() {
characterModel.getRenderableInstance().getFilamentAsset().releaseSourceData();
characterModel.getRenderableInstance().destroy();
ResourceManager.getInstance().reclaimReleasedResources();
ResourceManager.getInstance().destroyAllResources();
SceneView.reclaimReleasedResources();
sceneView.destroy();
EngineInstance.getEngine().destroyScene(sceneView.getScene().getRenderer().getFilamentScene());
} |
Beta Was this translation helpful? Give feedback.
-
Or just move to SceneView its quite easy if your project is not so big. |
Beta Was this translation helpful? Give feedback.
-
Hi, So I have been struggeling with the memory leak problem for months. I'm working on a project with android studio using AR-Core and Sceneform library (version 1.16). In this version I use .glb object format. The problem is that the graphical memory does not release the rendered objects after I choose to remove them and it causes the app to crash. I used the profiling tool of the android studio and I saw that the run-time memory usage keeps increasing till it reaches the maximum capacity (4GB) and the app crashes. The function to detach the virtual object has the bellow commands : { baseAnchor.getScene().onRemoveChild(baseAnchor.getParent()); baseAnchor.setRenderable(null); baseAnchor.setParent(null); SceneView.reclaimReleasedResources();}
the above commands just remove the object from the app visually but I beleive that the reference to the objects are still some where. The weird thing about this problem is that previously I used to have .SFB format object with the same detach function in sceneform 1.15 and the above commands worked there. The graphical memory is released for .SFB objects but in the new sceneform that supports gltf based objects the graphical memory is not released. Can some body help me with this problem? Thanks ahead
Beta Was this translation helpful? Give feedback.
All reactions