Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8289929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:38:39+00:00 2026-06-08T12:38:39+00:00

Winform OpenFileDialog,everytime I open it,the memory will increase,dispose () and OpenFileDialog = null not

  • 0

Winform OpenFileDialog,everytime I open it,the memory will increase,dispose () and OpenFileDialog = null not working,the memory does not lose. .

how to fix this ??

   private void btnLocalPicture_Click(object sender, EventArgs e)
    {
        OpenFileDialog ofdSelectPicture = new OpenFileDialog();
        ofdSelectPicture.Filter = "PicFile|*.jpg;*.png;*.jpeg;*.gif;*.bmp;*.tif";
        if (ofdSelectPicture.ShowDialog() == DialogResult.OK)
        {
            if (showPicture != null)
                showPicture.Dispose();
            showPicture = Image.FromFile(ofdSelectPicture.FileName);
            if (pbShowPicture.Image != null)
                pbShowPicture.Image.Dispose();
            pbShowPicture.Image = showPicture;
            path = ofdSelectPicture.FileName;
            WordTip.Visible = false;
            if (pbShowPicture.Image != null)
                picOK.Enabled = true;
        }
        ofdSelectPicture.Dispose(); //not working
        ofdSelectPicture = null;  //not working
        GC.Collect();
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T12:38:41+00:00Added an answer on June 8, 2026 at 12:38 pm

    You can see what’s going on with Project + Properties, Debug tab, tick the “Enable unmanaged debugging” option. Start your program and select the Output window. Get the dialog displayed.

    You’ll now see a list of DLLs getting loaded into your process. These are shell extensions registered on your machine. Exactly what you’ll get is unpredictable, everybody has their own set of favorite extensions. Programmers tend to have a lot of them.

    Yes, these extension will consume memory in your process. Just by the fact that these DLLs occupy space in your virtual memory address space. But also because these DLLs allocate memory for their own use. And a poorly written one can certainly leak memory. Beware that the memory allocated by these extensions is always unmanaged memory so be sure you have a good tool that shows you the leak. Something like TaskMgr.exe isn’t good enough.

    Two basic things you can do about it. First is to just ignore it, this problem is specific to your machine and your user won’t have the same problem. You can’t fix the leak, you don’t have the source code for the extension. Or you can chase down the troublemaker with the SysInternals’ AutoRuns utility. It shows you what shell extensions are registered and allows you to un-register them by clicking a checkbox.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in WinForm on PC i use to run like this: FileStream FS = null;
My winform application crashes as soon as its been launched. This problem is only
My winform window was working fine then i added a combobox to it. Now
My winform has a progress bar which should increase based on the number of
In WinForm's control, there is an OnLoaded virtual function, but this seems to be
My WinForm application is configured like this: public class RepositoriesInstaller : IWindsorInstaller { public
I have a winform program that does some asynchronous IO on a SerialPort .
I have Winform application,which does some operation in loops (file access, copy file, ....).
The WinForm PropertyGrid copes well with a standard enum but does does have a
I have a Winform app that has a backgroundWorker thread and does all operations

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.