Clear Diagram memory

Hi,
My application uses several diagrams using the same diagram instance, namely when the user pushes a button, a diagram is loaded from DB into memory.
When the user pushes another button, the application clears the nodeDataArray and LinkDataArray and uses the same diagram variable to load a new diagram into memory.
The application DOES NOT create new diagram instance ((go.Diagram....)). We noticed that every time a new diagram is loaded into memory, the Chrome memory usage is increased. What can be done to avoid this memory increase ? if i run (go.Diagram…) every time i want to load a new diagram will it free memory ?

Have you turned on the UndoManager? If so, it’s accumulating all of those changes that you have done.

It’s normal to construct a new Model and assign Diagram.model each time you want to show/edit a new model. By default that will create a new UndoManager for each new Model, so there is no retained memory of previous “diagrams”. Yet the Diagram instance itself, including its listeners and templates and other property settings, remains.

So, you suggest that i will construct new go.Model every time i want to load a new diagram.
It will create new Model with clean UndoManager ? Right ?
I don’t have to create new go.Diagram. Right ?

That’s correct. If you look at all of the samples that have “Load” Buttons, you will see that they all construct a new model and assign Diagram.model.

Will do,
Thanks