Hi,
We found a small but steady memory leak in TouchDesigner 2025.33070 and 2025.33230 (Windows 11, Python 3.11).
Summary
Calling Python’s built-in round() directly on a Channel, Cell or Par object leaves one tuple object alive per call. The tuples are never freed (they survive gc.collect()), so the process memory keeps growing.
Calling round() on a plain float does not leak.
Minimal reproduction (paste into the Textport of an empty project)
import gc
def tuples():
gc.collect()
return sum(1 for o in gc.get_objects() if type(o) is tuple)
c = op('/project1').create(constantCHOP, 'leak_test_chop')
c.par.const0name = 'chan1'
c.par.const0value = 1.234
t = op('/project1').create(tableDAT, 'leak_test_table')
t.clear()
t.appendRow(['1.234'])
for label, f in [
('round(Channel, 2)', lambda: round(c['chan1'], 2)),
('round(Cell, 2)', lambda: round(t[0, 0], 2)),
('round(Par)', lambda: round(c.par.const0value)),
('round(float(Channel), 2)', lambda: round(float(c['chan1']), 2)),
]:
before = tuples()
for i in range(10000):
f()
print(label, 'tuples added:', tuples() - before)
Result on our side (2025.33070 and 2025.33230)
round(Channel, 2) tuples added: about 10000
round(Cell, 2) tuples added: about 10000
round(Par) tuples added: 10000
round(float(Channel), 2) tuples added: 0
Also observed
- The same happens when
round(op('x')[0], 2)is used in a parameter expression: 10,000 evaluations left about 10,000 tuples. - Arithmetic results are fine:
round(a / b, 2),round(1 - a / b, 5)andint(channel)do not leak. - In a real project, a CHOP Execute DAT that called
round()on two channels every frame added about 6,800 tuples per second, and the process memory grew by about 5–7 MB per minute. After wrapping the values withfloat(), the tuple count stayed flat. (The memory growth that remained after this fix turned out to be a separate issue, with empty CHOP Execute callbacks, which we report in a separate post.)
Workaround
Convert to float (or int) before rounding: round(float(op('x')[0]), 2).
Environment
- TouchDesigner 2025.33070 and 2025.33230 (Commercial), Windows 11 Pro, Python 3.11.15.
- Not checked: 2023 builds, 2025.31760, macOS.
Thanks for looking into this.