Skip to content

DialogParticipation.Register="{Binding}" Memory leak #4

@svantevit

Description

@svantevit

I am using MahApps.Metro, v1.6.5.

MetroWindow with mah:DialogParticipation.Register="{Binding}" doesn't get disposed after the ShowDialog() call.

Example usage: I have two windows - MainWindow and MyDialogView. Each has it's own view model - MainWindowViewModel and MyDialogViewModel.
MainWindowViewModel contains a OpenDialogCommand, which opens the dialog view.
MyDialogViewModel contains a CloseCommand, which raises an OnClose event. The MainWindowViewModel handles the OnClose event and closes the dialog window.

For easier debugging I instantiate a large byte array in the MyDialogViewModel constructor. If I open and close the dialog window multiple times the memory usage only increases (by 1GB). But if I remove the DialogParticipation.Register parameter, then the memory usage gets decreased when the garbage collector runs.

I prepared an example here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions