Permanently deleting a diagram along with model and other attributes


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 -

The diagram object still gets logged. I read 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?


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.