Permanently deleting a diagram along with model and other attributes

Hi,

I read here that removing the div should clear all the references of the diagram in the memory. However, it seems this is not the case.

Reproducer - GOJS - Event Listener - JSFiddle - Code Playground

The diagram object still gets logged. I read Replacing and Deleting Diagrams -- Northwoods Software article but I have many possible references in my app and it would not be possible to set all of them to null. Is there a better way to clean the diagram from the memory?

Thanks.

As long as your app has at least one reference to your Diagram instance, it will naturally keep all of its Nodes and Links and its Model and UndoManager and all of their data.

That Introduction page says that you should set Diagram.div to null. That way if you clear all your JavaScript references to the Diagram or any of its pieces, all of the memory associated with the Diagram will be garbage collected.