Open Bug 1572524 Opened 5 years ago Updated 2 years ago

Web Audio performance degrades after creating many running nodes, which should be garbage collected when not observable

Categories

(Core :: Web Audio, defect, P3)

68 Branch
defect

Tracking

()

People

(Reporter: yotammann, Unassigned)

References

(Depends on 1 open bug)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36

Steps to reproduce:

Open up this page: https://codesandbox.io/s/patient-thunder-wtjqi
Let it run for a few hundred iterations

Actual results:

Performance of the page slowly gets worse as it eats up more and more CPU until eventually the audio crackles and goes silent.

Expected results:

The audio should be able to run in this state forever.

My guess is that the oscillator which is connected to the detune signal is never garbage collected. I think according to the spec, unreachable nodes should be garbage collected and once the main oscillator is stopped, the connected detune oscillator should also be garbage collected. This does not seem to be happening. here. A similar performance degradation happens if a ConstantSourceNode is connected to the detune and started.

Should have mentioned in the "Steps to reproduce", that in the example codesandbox, you have to hit 'start' in order to start the audio.

Component: Untriaged → Web Audio
Product: Firefox → Core
Depends on: 897796
Priority: -- → P3
Summary: Web Audio Performance Degrades after creating many nodes (which should be garbage collected when finished) → Web Audio performance degrades after creating many running nodes, which should be garbage collected when not observable
Status: UNCONFIRMED → NEW
Ever confirmed: true
Severity: normal → S3

As a workaround you can add a call to detuneNode.stop(now+4) and it will no longer leak.

You need to log in before you can comment on or make changes to this bug.