hajimehoshi / ebiten

Ebitengine - A dead simple 2D game engine for Go
https://ebitengine.org
Apache License 2.0
10.88k stars 651 forks source link

audio: Player leak on browsers #852

Closed hajimehoshi closed 5 years ago

hajimehoshi commented 5 years ago

As runtime.SetFinalize doesn't work on GopherJS, the current players will never be released...

hajimehoshi commented 5 years ago

Oh, even though the finalizer is not executed, no objects are leaked. That's fine.

hajimehoshi commented 5 years ago

Ugh, as func (p *playerImpl) readLoop() never ends on browsers, playerImpl objects are leaked? But there is no way to handle this leak.

hajimehoshi commented 5 years ago

Note: When nothing refs an audio.Player object, the player is finalized after its playing finishes. This is achieved by runtime.SetFinalizer. However, SetFinalizer doesn't work on GopherJS.