Build: TouchDesigner 2025.33230 (built Sep 1 2026), Windows 11 Pro x64, Python 3.11.15.
Summary
When the network editor draws a new viewer tile for a Text DAT (we also saw it for a Noise TOP), TouchDesigner leaks about 6 tuples. Each one is a 1-tuple whose item slot holds NULL. The tuples stay tracked by the Python garbage collector, so gc.get_objects() returns them.
Python code that iterates, indexes or reprs one of these tuples crashes TouchDesigner with an access violation in CPython tupleiter_next. A normal memory probe that walks gc.get_objects() hits it. gc.collect() alone does not crash.
Steps to reproduce
- Open a new project. In
/project1, make a Base COMP and open it in a Network Editor pane. - In that Base COMP, make a Text DAT named
reprowith the script below. - In the Textport, run
op('/project1/base1/repro').module.start(20). - After about 1 second, the Textport shows the count of new tuples.
# Counts gc-tracked tuples with an empty (NULL) item slot. Safe: it never reads an item.
# Tuple traverse skips a NULL slot, so gc.get_referents(t) returns fewer items than len(t).
import gc
def empty_slot_tuples():
return {id(t) for t in gc.get_objects()
if type(t) is tuple and len(gc.get_referents(t)) != len(t)}
_s = {}
def start(cycles=20, viewer=True):
pane = ui.panes.current # a Network Editor pane
pane.owner = me.parent() # show this COMP, so the new op is drawn
_s.update(pane=pane, left=cycles, viewer=viewer, before=empty_slot_tuples())
_create()
def _create():
o = me.parent().create(textDAT, 'leaktest')
o.nodeX = int(_s['pane'].x) - 65 # at the view center
o.nodeY = int(_s['pane'].y) - 45
o.viewer = _s['viewer']
run('op(args[0]).module._destroy()', me.path, delayFrames=2)
def _destroy():
me.parent().op('leaktest').destroy()
_s['left'] -= 1
if _s['left'] > 0:
run('op(args[0]).module._create()', me.path, delayFrames=1)
else:
run('op(args[0]).module._report()', me.path, delayFrames=5)
def _report():
new = empty_slot_tuples() - _s['before']
print('new empty-slot tuples:', len(new))
Expected: new empty-slot tuples: 0.
Actual: about 6 for each cycle (we saw 120 for 20 cycles).
Controls (20 cycles each, same harness):
| Case | New tuples |
|---|---|
| Text DAT at the view center, viewer on | 120 |
Same, viewer off (start(20, viewer=False)) |
0 |
| Viewer on, but the pane shows the parent COMP (op not drawn) | 0 |
| Null CHOP at the view center (no viewer content) | 0 |
| 20 ops kept on screen, not destroyed | 6 in total |
So the leak occurs when a new viewer tile is drawn, not for each frame.
To see the crash (this closes TouchDesigner):
import gc
for t in gc.get_objects():
if type(t) is tuple and len(gc.get_referents(t)) != len(t):
list(t) # access violation in tupleiter_next
Impact: Any script or tool that walks gc.get_objects(), gc.get_referrers() or gc.get_referents() and reads the tuples crashes TouchDesigner. Memory probes and leak finders do this. We added a filter in our plugin as a workaround (it drops these tuples from the gc walk results), but the leak is in native code.
Request: Please fill the item slot (or untrack the tuple) before it becomes visible to the gc, or free these tuples.