Memory leak when loading model from JSON

I have tried to run the sample in ipad but safari reloads after a few clicks on the load button.

I have checked the memory usage and it shows it keeps on growing.

I have also tried to use the following code to clear the model before assign a new model.

$.get(url, function (content) {
var data = jQuery.parseJSON(content);
myDiagram.model.nodeDataArray = [];
myDiagram.model.linkDataArray = [];
myDiagram.model = go.Model.fromJson(data);

But the memory still grows

http s:// p g

We’ll look into this.

Simply executing myDiagram.model = go.Model.fromJson(…) should be sufficient to remove all traces of the old model and any pieces of the diagram used to display it. Calling clear() or replacing the data Arrays isn’t needed if you are about to replace the Diagram.model. (I assume you were just trying different things, experimenting.)

I don’t have an iPad handy at this moment, but I’m unable to reproduce any problem on my Android tablet. I’ve clicked the “Load” button more than 30 times.

In recording heap allocations in Chrome on my desktop, I do not see any memory being retained, even after a dozen loads of the MindMap sample’s model.

How are you detecting that there is a memory leak? And in particular, how are you detecting it on your iPad? Are you looking at the actual number of live objects?

In Chrome and IE11 there did not seem to be any GoJS allocations that were unexpected. No leftover Points, Geometries, Rects, etc, in between loads.

Especially in IE, where the snapshots after each successive load were identical in size.

Would you kindly test it ipad mini, as demo in my video? Thank you.


It seems OK to load indefinitely on the iPad Mini 3 (A1599) in Safari on iOS 8.2

I have seen similar issues with iPads/mobile devices in the past, but I’m unable to reproduce this specific issue.