I think that’s correct.
If you don’t want to remove the DIV element and instead want to disassociate the Diagram from the DIV, you can set Diagram.div to null.
If you want to keep both the DIV and the Diagram in place, but want to get rid of all of the contents, you can call Diagram.clear(). This is useful if you want to maintain any DiagramEvent listeners.
The most likely source of accumulating memory is in the UndoManager (when it’s enabled, of course). That’s part of a Model (although it can be shared by multiple models), so another way to “clear out” a diagram, while keeping both the DIV and the Diagram present, is to set Diagram.model to a new, empty model.
Another possible source of garbage retention are the event handlers and listeners, which might retain references to any objects referenced by closed-over variables in closures. As a general policy, unregister any listeners that you register.