Temechon Posted October 28, 2013 Share Posted October 28, 2013 Hello all, I have some performances issues when importing several scenes from Blender on tablet and some computers (with graphic drivers up to date). I have a page with several images displayed : when an image is displayed, a scene is loaded (like on www.babylonjs.com). I use this method to load a complete scene exported from Blender :BABYLON.SceneLoader.Load("models/", modelName, engine, function (newScene) { })In the callback function, I set up my ArcRotate camera, and a new light. My render function is very classical : scene.render() and stats display. My problem is : when I press the "back" button, and load another model (or the same one), I got a big FPS drop, from 60 FPS to 30 FPS (my model has ~20000 vertices)My handler on the back button takes care to destroy my previous scene : if (scene) { scene.dispose(); scene = null;}Is there something missing in my scene clean up ? Thank you for your help. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 28, 2013 Share Posted October 28, 2013 Hello could you compare to what we do on www.babylonjs.com ? The code is available on github (samples folder) Quote Link to comment Share on other sites More sharing options...
Temechon Posted October 28, 2013 Author Share Posted October 28, 2013 I compared your code to mine : It's basically the same. Only the scene is destroyed, and the engine is created each time you laod a new scene. But I think I got it : I have a increasing use of memory.I load one of my model : 100 Mo used. I load it 5 times more : 190 Mo used. And it keeps going on and on. I am using a single-page navigation model, so my page is never reloaded. Only the scene is stored in a "namespace global" variable to clean it up when creating a new one. I don't understand what's going on... Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 28, 2013 Share Posted October 28, 2013 We also used a SPA for wwW.babylonjs.com. (And I'm not sure we recreate the engine for each scene) Quote Link to comment Share on other sites More sharing options...
Temechon Posted October 28, 2013 Author Share Posted October 28, 2013 You are right, the engine is created once in the "onload" function. My bad.I will fix that up and get back to you. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 28, 2013 Share Posted October 28, 2013 sure:) Quote Link to comment Share on other sites More sharing options...
Temechon Posted October 28, 2013 Author Share Posted October 28, 2013 I think I found the problem. I have to create an engine each time I select a new scene, because otherwise the canvas element (which is in my selected page) is no more available : each time the "back" button is called, the canvas disappears.With only one engine, the first scene is displayed correctly, but I have nothing for the next one (canvas.width = canvas.clientWidth = 0) With one engine initialized for each scene (thus for each new one canvas element), I got performances issues. Engine.dispose() is correctly called though... Moreover, I got huge memory issues, and I think it is because of this. Could it be something not correctly done in the engine.dispose() method ? Maybe the webgl context is not released properly ? I will try to create an unit test for this to reproduce it more clearly. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 29, 2013 Share Posted October 29, 2013 Yes an unit test would be great to help you:) Quote Link to comment Share on other sites More sharing options...
Temechon Posted November 25, 2013 Author Share Posted November 25, 2013 Hi, I refresh this old topic : I finally got some time to create a unit test available here : https://dl.dropboxusercontent.com/u/17799537/testMemory.zip This is a windows 8.1 application created with visual studio 2013. Please don't pay attention to the application style (it's very ugly). You can load the model available and see by yourself. If you load it several time (click on the tile -> back -> clic on the tile -> back...) you will see that the memory used by the application is increased each time.The scene and engine clean is in the page groupedItems.js. At each scene and engine unloading, the memory used decreases, but not totally. Thank you for your help. Quote Link to comment Share on other sites More sharing options...
davrous Posted November 29, 2013 Share Posted November 29, 2013 Hi, I've just run the JavaScript memory profiler of VS 2013 and I can't reproduce the issue. The memory consumption remains flat: It increases the first time when you load the model but then, it only add 1K or less after several back/navigate actions. This is not significant. Bye, David GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Temechon Posted December 2, 2013 Author Share Posted December 2, 2013 Hello David, Thank you very much for your answer and for your time. With the VS performance tool, I don't have the same result as yours, it's slightly different.This is the result after 10 item load : http://imgur.com/AWesmMkAs you can see, the memory increases (not much, I do agree) but is never released. Moreover, this is the result I have with the Windows tool : http://imgur.com/a/IGryRThe first image is at the very first start of the app.The second one is after 10 load.The third one is after more than 20 load. What I don't understand in this is why does the memory consumption increase. I was thinking that after a model load and a back to the home page, the memory would not change. Cheers, Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.