title: Bitmap and handle memory leak
body: <p>I'm developing a simple C# winform application.
  I create a bitmap and get a bitmap handle.
  And use bitmap handle.</p>
  
  <p>At that time, when I dispose bitmap, is bitmap handle free memory?
  And when I free memory handle using DeleteObject method, is bitmap dispose?</p>
  
  <p>Thanks in advice.</p>
  
  <p>-----------EDIT------------</p>
  
  <pre><code>int prevCookie = 0;
  private void testMethod(object sender, EventArgs e)
  {
      Bitmap bmp = new Bitmap(100, 100);
      using (Graphics g = Graphics.FromImage(bmp))
      {
          //Draw some shapes on bitmap
      }
      int hBitmap = bmp.GetHBitmap().ToInt32();
      //I used intel media sdk library.
      int newCookie;
      intelMediaSdkVariable.AddImageFromHandle(hBitmap, out newCookie);
      if (prevCookie &gt; 0)
          intelMediaSdkVariable.RemoveItem2(prevCookie);
      prevCookie = newCookie;
      bmp.Dispose();
  }
  </code></pre>
  
  <p>At that time, when I call testMethod for 1000 times, memory increases.
  When I call bmp.Dispose(), is hBitmap free?
  How can I fix it?</p>