title: WPF BitmapSource Image Display issue
body: <p>I need to display 8k RGB image from a RAW byte array which I get from a framegrabber in wpf control at High fps speed. I am able to successfully convert and the byte array to BitmapSource and display it in the image windows in WPF. But since the grabber is generating images at around 5 FPS after display i am releasing the hold to the object but GC takes time collect the memory within which my application memory increases and freezes the application and my system. How to properly dispose the BitmapSource(CachedBitmap) created using the below method. Please help me out in disposing the object after use.</p>
  
  <p>I tried GC.Collect() while image change but it doesn't work.</p>
  
  <p>Here is my byte array to bitmap conversion code,</p>
  
  <pre><code>    int Width = 7680;
      int Height = 4320;
      PixelFormat PixelFormat = PixelFormats.Bgr24;
      int BytesPerPixel = 3;
  
      public BitmapSource ByteToImage(byte[] imageData)
      {            
          var stride = BytesPerPixel * Width;
          BitmapSource bitmapSource = BitmapSource.Create(Width, Height, 96d, 96d, PixelFormat, null, imageData, stride);
          bitmapSource.Freeze();
          return bitmapSource;
      }
  </code></pre>