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 989709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:50:09+00:00 2026-05-16T05:50:09+00:00

Here is the simplified block of code: private void timer1_Tick(object sender, EventArgs e) {

  • 0

Here is the simplified block of code:

private void timer1_Tick(object sender, EventArgs e)
{
    using(Bitmap bmp = new Bitmap(48, 48))
    { }
}
  • 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-05-16T05:50:10+00:00Added an answer on May 16, 2026 at 5:50 am

    Because there’s limited information in the question, I’ll only react in general terms on what seems to be the question.

    You create a small Bitmap on each timer tick. You use using. That means that the code is wrapped in a try/finally block. The finally block will call bmp.Dispose(), which disposes the bitmap. However, that does not mean that all managed resources are immediately cleaned up. This is only cleaned up with the next garbage collection cycle, and then, only when no references to the bitmap, or any of its references, exists.

    To find out whether you really have a memory leak, remove all other code and create a simple project with just the above code and a bit of initialization code. Place it on a form and add a button to that form. When you click the button, do a GC.Collect(), which will clear all freeable managed resources. If that doesn’t clean up your resources, you have a resource leak and you should post the minified project’s code.

    Note: if, inside the using-block, you use other unmanaged resources without adding a new using-block, then these will not be automatically disposed off. Wrap a using-block around each class that exposes IDiposable.

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

Sidebar

Related Questions

Here is a simplified version of the code I use. I need to rewrite
Here's a simplified version of my class: public abstract class Task { private static
Here is simplified version of my requirement I have a java class say Processor
I've got 3 tables that are something like this (simplified here ofc): users user_id
I look at example of dropdown menu here . Here is simplified jsfiddle example.
I am implementing a protocol library. Here a simplified description. The main thread within
I want to list all users with their corropsonding user class. Here are simplified
Here is the simplified table structure of PRICES : SKU PriceType FromDate ToDate Price
Here is my simplified database: user_post - id - post_id (FK) post - id
Here is a simplified version of what I'm trying to do through an expression.

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.