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

  • Home
  • SEARCH
  • 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 8105237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:06:36+00:00 2026-06-06T00:06:36+00:00

Is it possible that when calling multiple times this function: void Func(String spr, PictureBox

  • 0

Is it possible that when calling multiple times this function:

void Func(String spr, PictureBox pictureBox)
{
    ToolTip toolTip = new ToolTip();
    toolTip.Show(spr, pictureBox, 1000);
}

memory leak will occur?

After function is finished tooltip is still there is it even possible that it is just going out of scope and disposing itself?

If the answer is “yes” for the first question, is creating my own toolTip which is self disposing from timer_tick a good solution?

public partial class MyToolTip : ToolTip
{
    public MyToolTip()
    {
        InitializeComponent();
        timer.Interval = this.AutomaticDelay;
    }

    private void timer_Tick(object sender, EventArgs e)
    {
        this.Dispose();
    }
}

If in this case this is not necessary is it applicable in other cases when time of object life is known or is it just bad design?

I’ve chosen this solution because i want to be able to show many tooltips at the same time.

  • 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-06T00:06:37+00:00Added an answer on June 6, 2026 at 12:06 am

    The ToolTip object will still exist in memory after the method has executed and each time the method is called a new ToolTip instance is created. It’s better to reuse an existing ToolTip. e.g.

     ToolTip toolTip = new ToolTip();
     void Func(String spr, PictureBox pictureBox)
     {
    
         toolTip.Show(spr, pictureBox, 1000);
     }
    

    edit For multiple tooltips and to dispose explicitly (outside the GC) without the need for a custom object, you could try something (somewhat hacky 😉 ) like:

     var toolTip= new ToolTip();
     toolTip.Show(spr, pictureBox);
     new System.Threading.Timer(o => tt.Dispose(), null, 1000, System.Threading.Timeout.Infinite);
    

    The above will work, although, perhaps it would be better to reuse a timer.

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

Sidebar

Related Questions

is it possible that my mingw 3.4.5 installation is faulty? or is this provided
I am told by someone that when calling Oracle from ADO.net, when calling multiple
I'm writing a little crawler that should fetch a URL multiple times, I want
Is it possible that there are more than one certificate chain built during the
It is quite possible that I'm just looking for help finding the name of
Is it possible that when you have a webpage, when you open the PDF,
It is quite possible that I may not have got the point, but I
It's possible that I'm not really understanding how git works here, but I have
Is it possible that the html page loaded, cannot be refreshed or reloaded by
Is it possible that I reserve a asp.net code in db and load it

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.