HydraIssues

Moonlight ControllerSupport never releases: cleanup is unreachable for a modal stream, and it retains a whole StreamFrameViewController per stream
open bug Project: hydraheadipad Reporter: 7 Nov 2026 15:16

Description

Measured while building controller menu navigation (issue 1140). Two facts, both read in the code, neither yet measured on a device.

  1. Cleanup never runs. [_controllerSupport cleanup] is reached only from -willMoveToParentViewController: with a nil parent (Limelight/ViewControllers/StreamFrameViewController.m:229-233), which is a CHILD CONTAINMENT hook. HydraStreamSession presents that view controller as a modal (UIModalPresentationFullScreen) and dismisses it from presentingViewController. Nothing ever adds it as a child, so cleanup is dead code in this build.

Consequences after every stream: the six GameController notification observers stay registered, every extendedGamepad.valueChangedHandler stays installed, and preferredSystemGestureState stays GCSystemGestureStateDisabled on every element, because unregisterControllerCallbacks: is the only code that restores it.

  1. Each leaked instance retains a view controller. _delegate is a plain strong ivar (Limelight/Input/ControllerSupport.m:31), so every leaked ControllerSupport retains a whole StreamFrameViewController and its stream view and decode stack. A kiosk that runs for a week and streams many times a day accumulates one per stream.

A second stream also builds a second ControllerSupport while the first still observes. Both react to GCControllerDidConnect and both write the shared controller.playerIndex (ControllerSupport.m:978).

Not urgent for input correctness: sendControllerEventInternal returns -2 behind if (!initialized), so the leaked handler's at-rest LiSendMultiControllerEvent calls are a verified no-op.

The controller menu work in 1140 was deliberately built to SURVIVE this rather than repair it. It assigns per element handlers only, which are separate properties from the gamepad level handler, so nothing in v0.3.0 depends on this changing.

Fixing it needs a pushed hydra-moonlight-ios commit, a submodule pointer bump proved by a validate.yml run before any tag, and a device. Check one thing first: HydraStreamSession.stop dispatches to the main queue only for the dismiss, so a release call added at teardown may run haptic, motion and battery teardown off the main thread.

Session Context

Venue
cloud-seven