In my program, I’m seeing all of the above mentioned types increase, but in this sample below, I’m only seeing CopyOnWriteObject and NodeReferenceCount increase. My program is much larger, but it doesn’t have any global variables, so I’m not sure why it’s different here. You can still see memory going up indefinitely though. Does this help?
from direct.showbase.ShowBase import ShowBase
from direct.actor.Actor import Actor
from panda3d.core import *
import operator
import time
import pprint
ShowBase()
def setup():
base.disableMouse()
base.camera.setPos(50, 50, 200)
base.camera.lookAt(50, 50, 0)
base.openMainWindow()
def createScene():
for i in range(10):
for j in range(10):
a = Actor("models/panda")
a.reparentTo(render)
a.setPos(i*10,j*10,0)
def step():
base.taskMgr.step()
base.taskMgr.step()
time.sleep(1)
def destroy():
for child in render.getChildren():
if child != base.camera:
child.removeNode()
base.graphicsEngine.removeAllWindows()
last_top = {}
def printTopMemory():
global last_top
mup = MemoryUsagePointers()
MemoryUsage.getPointers(mup)
type_count = {}
for i in range(mup.getNumPointers()):
obj = mup.getPythonPointer(i)
count = type_count.get(obj.__class__, 0)
count += 1
type_count[obj.__class__] = count
type_count = sorted(type_count.iteritems(), key=operator.itemgetter(1), reverse=True)
for type, count in type_count:
if last_top.get(type, 0) != count:
print 'type %s changed to %d' % (type, count)
last_top = dict(type_count)
while True:
setup()
createScene()
step()
destroy()
printTopMemory()