Okay, I’m pretty sure this is working how it’s supposed to but because it’s a matter of garbage collection I’d like to have it confirmed by a second set of eyes.
I have a class that is managing icons floating above character’s heads. Those icons are stored in a list. Here’s how they are generated:
def addPlus(self, color, id): self.plus.append([self.assetLoader.modelLoader("/Utilities/Plus.egg"), id]) self.plus[len(self.plus) - 1].setColor(color.getX(), color.getY(), color.getZ()) self.plus[len(self.plus) - 1].reparentTo(self.iconNode) self.plus[len(self.plus) - 1].setScale(.1,.1,.1) self.arrangeIcons()
And here is how they are removed:
def removePlus(self, id): count = 0 for I in self.plus: if(I == id): I.removeNode() self.plus[count:count+1] =  else: count += 1
Nothing else touches the icon models stored in the list at all. The icons do vanish from the scene, and I know they get removed from the list because I printed it out. That should mean there are no references to them and they get cleaned up, right?