Closed mcfly10 closed 4 years ago
on my side it seem ok, did you check in your debug listener
For me gui.destroy(); perfectly works. It traverses through all the folder/nested folders and look for controls and unregister them.
I'm not able to reproduce this sorry. I think it was fixed in a previous version. If you still have the problem, please provide a demo so we can debug. Thanks!
I'm having issue cleaning up listeners as well. (on 0.7.7
)
I used the test code below
function testDAT() {
var FizzyText = function() {
this.message = 'dat.gui';
this.speed = 0.8;
this.displayOutline = false;
}
for (let n=0; n<100; n++ ){
var text = new FizzyText();
var gui = new dat.GUI();
gui.add(text, 'message');
gui.add(text, 'speed', -5, 5);
gui.add(text, 'displayOutline');
gui.updateDisplay();
gui.destroy();
}
};
var FizzyText2 = function() {
this.message = 'dat.gui';
this.speed = 0.8;
this.displayOutline = false;
}
function testDAT2() {
for (let n=0; n<100; n++ ){
var text = new FizzyText2();
var gui = new dat.GUI();
gui.add(text, 'message');
gui.add(text, 'speed', -5, 5);
gui.add(text, 'displayOutline');
gui.updateDisplay();
gui.destroy();
}
};
and my Performance
Log in Chrome DevTools is showing
where the Nodes
and Listeners
remain high (>2K) after GC.
However, I can't seem to find any of these listeners when I look at EventListener
of the elements in DOM Tree.
Is the Listening trace in Performance not what I think it is or are the listeners not getting unergistered properly by destroy
?
After I make
datGui.destroy()
it still scans for binded objectsAfter removing console still writes "Scan value". It s not critical for static properties, but for getters it could slow the performanse.