p5.js-sound
p5.js-sound copied to clipboard
Leak of dispose after sound stop
Nice to meet you. I found a simple leak.
After calling stop() , There is a reference left to _counterNode
The cause is simple.
dispose function
if (this.isPlaying()) {
try {
this._counterNode.stop(now);
} catch (e) {
console.log(e);
}
this._counterNode = null;
}
When Call dispose() after stop(), the reference of _counterContainer remains. so I try this code. Leaks no longer occur.
if (this.isPlaying()) {
try {
this._counterNode.stop(now);
} catch (e) {
console.log(e);
}
}
this._counterNode = null;
Are you aware of the negative things of this change?