Out of memory on Document.Clear()

Hello everyone

I’m building an application based on the DataSet demo, I’m using Document.Clear() to clear the GoView and its working fine until the amount of objects grows (over 1000) and I get an out of memory error on the Autolayout sub.

How can I avoid this?

Thanks in advance.

Using the same Tree Layout the DataSetDemo uses?

Does the error occur after repeated load/layout/display/Clear cycles?

or does it happen without the Clear if you start with over 1000 objects?

Yes I’m using the same Tree Layout (Autolayout) minus:

        'layout.Network = network
        'layout.PerformLayout()

Since it caused me some problems which we addressed a few weeks ago.

It only happens when I start with over 1000 objects

If you’re not doing the PerformLayout, you aren’t doing any layout at all, right?

If that’s true, it would be better not to call AutoLayout at all, and not allocate the
GoLayoutTree and GoLayoutTreeNetwork objects.

Right on, it worked that way.

I have another question. If I where to call the ExpanAll() (the one that is in the PersonNode class) upon a diagram that is collapse it should expand all the collapsed branches right?

And if I wanted to Do the opposite I should create a CollapseAll() that might look like this?

Public Overridable Sub CollapseAll()
        Collapse()
  For Each node As IGoNode In Me.Destinations
    Dim child As PersonNode = Nothing
    If TypeOf node Is PersonNode Then child = CType(node, PersonNode)
    If Not child Is Nothing Then
                child.CollapseAll()
    End If
  Next
End Sub

Should I post this on a separate topic?

Thanks for your help Jake

Wolfgang