Not a real issue here, just wanted to confirm something about Lights and mention something else. I was using the Session Panel to view my Scene Graph as I deleted an entire level (in other words I ran a cleanup on a level).
The entire level did disappear from around my character and I could see the Nodes disappear from the Scene graph.
I noticed one thing… My character was still receiving light from the light nodes. I even looked through my Scene Graph to confirm some light Nodes were still there.
Ok… So, I decided to kill the lights on my main character.
maincharacter.setLightOff(somelightNodePath);
After setting all lights to off for my Main Character, I ran my cleanup test again. This time I noticed the light nodes were NOT in the Scene Graph.
And that’s what I want to confirm; must lights be turned off for every object within the class in order to correctly garbage collect them? My test says yes, but I want to get a few more opinions. I know you can’t leave a reference behind for anything, but I didn’t think the setOff or On for lights would count as one.
Aside from the lights, I do like the fact overall game memory did not increase when I dumped the first level and created a different one by creating a new level’s instance.
One thing is bothering about this memory management with P3D. Even if you successfully dump resources, delete all of a class’s attributes and remove all running tasks… The instance of that class will still remain.
It’s not like you called a del statement on the instance itself.
class Human(ShowBase):
def __init__(self):
self.name = "morgan"
Thief = Human()
You would think an instance of an object class would be totally deleted once you call del on the instance directly, after you’ve done your garbage collecting, as in.
del Thief
Otherwise you have an instance that has been cleanup up of resources, but the scope of the instance is still around. I’m not even sure if a del self call would work after a garbage collection, but I include it anyway.
At least I’m not seeing a memory spike, so I’m not going to pull my hair out just yet. I’ll wait until I see the game memory constantly increasing without freeing up after my garbage collecting from level to level.
I guess if I can see all the right Nodes delete from my scene graph, I should consider that a win with garbage collecting.
Any takers on this thought?