Memory usage

hello,

from now i test te memory consumption of my application. I have some troubles with diagram free.

I use godiagram for wpf version 1.2.6.3.

With a memory profiler I see that after unload the “diagram”'s control, some GoXam.Node object still retained.

I observed that if I don’t show the associated overview, no more node still retained after control closing.

<go:Diagram x:Name="myDiagram" Loaded="myDiagram_Loaded" Unloaded="myDiagram_Unloaded"
                    InitialScale="1"
                    Grid.Column="2" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"
                    AllowDrop="True" AllowCopy="True" AllowLink="True"
                    NodeTemplateDictionary="{StaticResource NodeTemplateDictionary}"
                    LinkTemplateDictionary="{StaticResource LinkTemplateDictionary}"
                    Layout="{Binding Options.LayoutChoosen}"
                    Padding="10 10 0 0" 
                    SelectionChanged="myDiagram_SelectionChanged"
                    UnloadingClearsPartManager="False"
                    ContextMenu="{StaticResource menuDiagram}" 
                    Model="{Binding QD_Model}" >
                    <go:Diagram.LayoutManager>
                        <go:LayoutManager Animated="False"/>
                    </go:Diagram.LayoutManager>
                    <go:Diagram.TextEditingTool>
                        <v6QDiagram:QD_TextEditingTool Starting="SingleClick"/>
                    </go:Diagram.TextEditingTool>
                </go:Diagram>
private void myDiagram_Loaded(object sender, RoutedEventArgs e)
{
        myDiagram.InitialLayoutCompleted += new EventHandler<DiagramEventArgs>(myDiagram_InitialLayoutCompleted);
}
 private void myDiagram_Unloaded(object sender, RoutedEventArgs e)
{
        myDiagram.InitialLayoutCompleted -= myDiagram_InitialLayoutCompleted;
}
private void myDiagram_InitialLayoutCompleted(object sender, DiagramEventArgs e)
 {
         myOverview.Observed = myDiagram;
}

I tried to reset myOverview.Observed (= null) in diagram_unloaded, but Node still retained.

Have you an idea ?
Thanks
Aurore

Is it always just one Node regardless of the size of your model? That might be the Overview.Box node. Except that’s unlikely to have a PartManager.PartBinding.

Do you know what the retained reference is to? Is it the value of PartBinding.Data? Or is it something else?

As far as i understand the profiling tool,

I have 35 retained nodes (one for each model item).

in other words, i use a MVVM code structure. then Control is unloaded as environment (graphmodel still alive).

The GoXam.Node contains a reference to the GraphLinkModel (which is not removed). Could it be the problem ?

Here’s an image of what is contained by a Node.

Here’s an image of what retained the node :

I’m sorry if i’m not clear but it’s not clear for me at all, the .Net memory managment…

Thanks
Aurore

After setting the myOverview.Observed = null, try calling myOverview.PartManager.RebuildNodeElements() as well.

RebuildNodeElements does nothing else.

I just see that if i close the dockpanel which contains overview before main control unloading, i obtain only 1GoXam.Node retained…

I have a problem with dockpanel… I don’t be sure that it is a goxam problem, i will investigate.

thanks
Aurore

Another possibility is to assign a new model to the overview:

myOverview.Observed = null;
myOverview.Model = new UniversalGraphLinksModel();

I doubt the problem is with DockPanel.

But I would not be surprised if there’s no real solution, since WPF is well known for data-binding-related memory leaks.