FIXED: MacOS Movie File In leak/growing cook time with loop crossfade

TouchDesigner 099
64-Bit Build 2022.33910

2023 M2 Ultra Mac Studio
128GB Ram
MacOS 13.5 (22G74)

When Loop Crossfade is enabled, the Movie File In TOP’s cook time will consistently grow during crossfade periods. If you’re playing back multiple high res videos with TOPs that have crossfade, this happens for every Move File In TOP so the issue stacks and you’ll lose 60FPS quite quickly.

From my testing, I’ve tried with 1080p, 2k, 3k, and 4k HAP playback, this happens consistently, 100% of the time for any Movie File In TOP with crossfade enabled. Note I’m not seeing growing cook time for the movie file in TOPs with zero crossfade, so it seems strictly tied to crossfaded loops. Enabling/disabling interpolation has no impact on outcome (will grow every loop either way)

Attaching a trail showing the growing cook time (you can easily reproduce with a single movie TOP with crossfade as long as you’re using a codec that can keep up, will be more pronounced with high res videos). Also attaching my config of the movie TOP

Screenshot 2023-09-16 at 1.12.19 PM
Screenshot 2023-09-16 at 1.12.23 PM
Screenshot 2023-09-16 at 1.12.34 PM

Additional info from further testing:

  • There’s definitely also a memory leak alongside the increasing cook time
  • Dropping pre-read and timeout do not resolve
  • If I disable the crossfade I’ll see cook time come back down and settle to a stable state, but you can see memory still leaking

Captured some better data by getting a running avg for cook against CPU mem usage. (Note I also checked GPU mem, read ahead misses, and a few others, no discernible trendlines with them, seem normal)

Crossfade enabled

Crossfade enabled, no pre-read/timeout

After disabling crossfade, cook time settles down but mem leak continues

Unfortunately this is pretty devastating for video workflows on Mac. Crossfade is basically unusable for any serious high-res video projects.

Would greatly appreciate any help! Please lmk if I can provide anymore useful information.

Thanks for the report - we’re taking a look.

1 Like

I’m actually not able to reproduce this as you show it. The cook time spikes themselves seem fine offhand, Loop Crossfade does more than 2x the amount of work, so the node should take more than 2x as long to cook during a crossfade. I wouldn’t expect the times to climb like you are showing though. Are you able to share your example .toe file and possibly your content.

The other things to keep in mind is that the cpu_mem_usage channel on macOS is the amount of memory resident currently, not the amount used by the process as a whole. Memory can be paged in/out freely by the OS, and I can’t seem to find a good way to get the ‘total memory usage’ of the process. If you use the Activity Monitor though, do you see the ‘Memory’ column growing in your tests?

Noted on memory, I’ll give a more detailed look tomorrow and let you know.

Here’s a link to a ZIP with the TOE from above and a sample HAP video (also confirmed I’m seeing the cook time increase with this exact TOE+video)

Also including just the TOE here for anyone that doesn’t want to download the larger HAP video
moviefilein_leak.toe (4.0 KB)

Was able to do a better test for memory usage. This is tracking real memory usage based on unique set size for the process (+ subprocesses) over a 10min period. Using the sample TOE+video I attached above.

Looks like it may be leaking ~150MB over that 10min period. There may be something to what you’re saying in terms of how the OS is handling allocations but it definitely feels like either way there are some unnecessary allocations happening somewhere in the video playback logic (independent of crossfade). I haven’t been low level in MacOS in a long time though so it’s certainly possible I’m overlooking something OS side.

Also here’s the raw data: (550.1 KB)

Again really appreciate you guys looking into this and lmk anything else I can help with!

Thanks for this example, this bug will be fixed in the next builds we post.

Wonderful, thanks so much!