0

I use a CommonOpenFileDialog as a FolderBrowserDialog. For this, I had downloaded the WindowsAPICodePack-Shell.1.1.1 via NuGet. I noticed that when loading the dialog, my memory usage increases from 18MB to 55 MB, and after exiting (whether successful or not) it only drops to ≈36 MB. What can this be related to? And what can I do?

Dim Ordnerpfad As String = ""
        Using OFolderD As New CommonOpenFileDialog
            OFolderD.Title = "Ordner auswählen"
            OFolderD.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
            OFolderD.IsFolderPicker = True
            If OFolderD.ShowDialog() = CommonFileDialogResult.Ok Then
                Ordnerpfad = OFolderD.FileName
            Else
                Return
            End If
        End Using

picture of the memory usage

Daniel
  • 374
  • 1
  • 12
  • Possibly depending on your version of Visual Studio, there are some diagnostic tools you can use to take a closer look at the details of memory usage. Do be aware that garbage collection in .NET means that you usually won't get memory back immediately when you're done with it. There are ways to force it to collect, but I would recommend avoiding them unless you really need it (and an example like this is probably not something where you really need it). – Craig Jan 05 '21 at 14:01
  • "Do be aware that garbage collection in .NET means that you usually won't get memory back immediately when you're done with it". OK thanks. Just wanted to hear this from someone who knows better than me. – Daniel Jan 05 '21 at 14:25

0 Answers0