we are having issues with the GD viewer (version 4) not releasing memmory when CloseImage() is called.
we are currently using the viewer to diplay frames from a USB CMOS camera, each frame is recieved as raw image data then constructed into a bitmap. the problem is when CloseImage() is called memmory is not getting released (page file increases to the point that the GD viewer window goes blank), i have concluded this by just displaying the image in a standard picturebox control, which works fine. the code i am using is below:
- Code: Select all
Private Sub DrawImage()
If IS_Drawing Then Exit Sub
IS_Drawing = True
' get geometry of image buffer
Dim width As Integer = 0, height As Integer = 0, bitspp As Integer = 0, pitch As Integer = 0, bytespp As Integer = 0
Dim imagesize As Long = 0
m_uEye.InquireImageMem(m_pCurMem, GetImageID(m_pCurMem), width, height, bitspp, pitch)
bytespp = (bitspp + 1) / 8
imagesize = width * height * bytespp
' image size in bytes
Dim MyBitmap As Bitmap
' bulit a system bitmap
MyBitmap = New Bitmap(width, height, PixelFormat.Format24bppRgb)
' fill the system bitmap with the image data from the uEye SDK buffer
Dim bd As BitmapData = MyBitmap.LockBits(New Rectangle(0, 0, width, height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb)
m_uEye.CopyImageMem(m_pCurMem, GetImageID(m_pCurMem), bd.Scan0)
MyBitmap.UnlockBits(bd)
Image_Exists = True
Try
Me.DisplayWindow.CloseImage()
Me.DisplayWindow.DisplayFromStdPicture(MyBitmap)
'the page file sizes increases to the point of the app crashing
Catch ex As Exception
End Try
IS_Drawing = False
End Sub
any help will be appreciated, thank you,
don
