Freeze in SendOnPlayableDirectorPlay()

Hello. Sometimes we get a seconds - sometimes almost or over a minute - long freeze when calling PlayableDirector.Play(); - according to the profiler, the culprit is a method called PlayableDirector.SendOnPlayableDirectorPlay(). This call seems to be spamming calls to GC.Alloc (e.g. we have 24582 calls to GC.Alloc, allocating a total of 0.8 MB; SendOnPlayableDirectorPlay() taking up 24628 ms.)

Any ideas as to what we might be doing wrong here / how we should be doing things instead?

A couple thoughts

  1. The Play() is actually the culprit - in particular the instantiation of the instance of the timeline. Timeline does allocation - creating script playables along with some internal housekeeping for the timeline playable are the main culprits of allocations although ControlTracks that use prefabs and other custom tracks can always increase those allocations substantially. One way to test this is to use PlayableDirector.RebuildGraph() to create the instance prior to playing it. If the cost moves to RebuildGraph, then creating the instance is where the allocations are occurring.

  2. Something is listening to PlayableDirector.played events and is causing the allocation.