OutOfMemoryException loading big image to Bitmap object with the Compact Framework
I have a problem with a memory leak. I have this code in a button_click : Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim ms As New IO.MemoryStream Dim bm As New Bitmap("\Application Data\imgs\IMG22.jpg") bm.Save(ms, Drawing.Imaging.ImageFormat.Jpeg) End Sub This code works just fine when I'm running the .exe at my laptop (I mean under windows7/32bits with the full .net framework) but when I run the app in a device with WindowsMobile 6.1 the app throws this exception: SmartDeviceProject22.exe OutOfMemoryException at Microsoft.AGL