Hi all, I have started looking into tearing down my scene graph, etc.
Using the Profiler I have been able to determine ‘my app’ no longer has refrences to any spatials, etc (including the rootNode).
However I am seeing something called LighList having many references to my spatials previously created.
Also of note, there are zero spotlights/lights, etc shown in the profiler.
So…this leads me to question, given a scene that has lights, what is the proper way to tear down the scene to ensure these lightlists remove there refrences as well?
I see spatial, exposes 2 methods: getLocalLightList(), and getWorldLightList().
Am I supposed to call these methods prior to ‘destorying’ a spatial, and explicitly call clear on these? 'shouldn’t removing of the light do this automatically?
Well are the lightlists still reachable from a living object? It is completely valid to have a network of objects that can no longer be reached, but are not yet gc’d, so this does not have to be an error.
Well, from what I can tell everything points back to GLContext having the ‘owner’ references (even though rootNode has no children).
also of note: this scene actually has no lights in it (everything is unshaded).
The objects are loaded via the assetManager.loadModel (blender loader)…and going throught the reference chain I do see BinaryImporter.
Which…kinda makese sense to me, I assume when you load stuff via the assetManager, it holds reference…is there a way to flush/unload the assetManagers references? or way to dump the current assetManager and obtain a new one?
If geometries would reside in memory I could not play Mythruna for several hours. Direct memory is not always collected even if the gc runs, maybe it has to do with that. Do you have an actual real world issue or why do you investigate this?
I wonder if the nodes are removed from the scene but then the update loop is not run anymore that the light list does not get rebuilt or something. Since he looks in the profiler and still sees references then that could be the reason.
If so, then that’s probably a false positive in this case. Since I don’t know why you’d want to empty the scene and otherwise keep running the app without then adding more things and rendering them (which would rebuild all of that stuff).
I’m only speculating based on the limited evidence presented… and the fact that as normen points out, Mythruna chews through Geometry objects like sweet candy and can run for hours and hours at nearly constant memory.
Yeah, I started looking into this due to huge slowdown (~40%) on android, essentially when I unload the scene graph, then reload to play another ‘map’, the 2nd ‘instance’ map played, is always much slower, and it continues to degrade each time I switch to a new map. On my desktop I do not notice nearly as severe a drop in performance, but…of course on my desktop the gpu can handle/memory/cpu can handle the ‘extra’ overhead, so I believe.
I can do a test that pspeed suggests, (load 1 blender file), then unload it, and load another scene or maybe even the same scene, and then check if I can locate ‘older’ geometries floating around.