SRGSSR / pillarbox-apple

A next-generation reactive media playback ecosystem for Apple platforms.
https://testflight.apple.com/join/TS6ngLqf
MIT License
45 stars 6 forks source link

Resource leak in `ReplaySubject` #801

Closed defagos closed 2 months ago

defagos commented 2 months ago

Description of the problem

ReplaySubject subscriptions are not properly removed when cancelled (they are when the subject is deinitialized, but not when each subscription is cancelled).

As a result, after a while, some performance issues can be experienced, e.g. seek bar sluggishness (especially if using a high refresh rate, e.g. 500 Hz).

Relevant stack trace or log output

No response

Reproducibility

Always

Steps to reproduce

  1. Tweak the TimeBar to have 1/500th as update interval.
  2. Play with the slider for a while and observe it gets slower over time.

When observed via Instruments we can see that ReplaySubscriptions are never deinitialized before the player is closed and destroyed.

Library version

1.0.0

Operating system

iOS 17

Code sample

No response

Is there an existing issue for this?