HTML5 audio and garbage collection
According to this source, Audio can be garbage collected, but it does seem to imply you may need to use the new Audio()
constructor in JavaScript to make use of this feature rather than a reference to the HTML element.
developer.mozilla.org/en-US/docs/Web/API/HTMLAudioElement/Audio#memory_usage_and_management
Memory usage and management
If all references to an audio element created using the Audio() constructor are deleted, the element itself won’t be removed from memory by the JavaScript runtime’s garbage collection mechanism if playback is currently underway. Instead, the audio will keep playing and the object will remain in memory until playback ends or is paused (such as by calling pause()). At that time, the object becomes subject to garbage collection.
Read more here: Source link