theatre icon indicating copy to clipboard operation
theatre copied to clipboard

Many event listeners created by theatre/studio, possible memory leak

Open donmccurdy opened this issue 2 years ago • 1 comments

We've been noticing that while scrubbing the sequence position, theatre/studio appears to create a lot (thousands?) of listeners, and the JS Heap climbs pretty fast as well. These eventually do get cleaned up, but it seems like a possible performance bottleneck that we weren't seeing before the v0.5.x prereleases. We encountered this in our own project but it's easily reproducible by scrubbing the sequence time in a playground link as well. In the screenshot below, each area where the graph is climbing corresponds to when I was scrubbing the sequence. I see the same issue when driving the sequence by scrolling in our application, but I don't see the issue if theatre/studio is not hooked up:

Screen Shot 2022-07-20 at 1 28 20 PM

donmccurdy avatar Jul 20 '22 18:07 donmccurdy

Thanks @donmccurdy! This is a pretty urgent issue. It'll be fixed in the next release!

AriaMinaei avatar Jul 20 '22 19:07 AriaMinaei

Hey @donmccurdy, to confirm, was this issue fixed in 0.5?

vezwork avatar Oct 20 '22 14:10 vezwork

Visiting https://theatre-playground-theatrejs.vercel.app/shared/r3f-rocket and scrubbing the timeline, you'll still see a lot of this memory allocation:

Screen Shot 2022-12-13 at 10 56 21 AM

That said, I'm not seeing user- or developer-facing performance issues to suggest that these allocations are causing any actual problems. If it's just a hypothetical problem during editing, and doesn't affect runtime use at all, then we probably don't need to keep this issue open. Thanks!

donmccurdy avatar Dec 13 '22 16:12 donmccurdy