- Yes
- I wish (And do not even try to claim power toys, the profiler will help you).
You will need to view your code. Make sure you call Dispose on all disposable objects, including all GDI objects, bitmaps, brushes.
Secondly, if you ever call Font.ToHFont, this call is extremely dangerous because it requires p / to call DeleteObject to clear after it. (Managed call requires p / invoke not to leak resources)
My only advice: for some reason, most of the time, my AGL errors are close to the source of the problem. I can’t remember the specific reasons. At work, we call it the undocumented “Accelerated Layer of Sorrow (AGL)”
Finally, I have another hot question. You select many raster images at the same time, then free them up and finally try to create managed memory objects, possibly buffers? Windows Mobile 6 is built from Windows CE 5.0, not Windows CE 6.0. Therefore, each process has a limit of 32 MB for memory. If you select many raster images at the same time, they increase the size of the unmanaged heap. When you delete bitmaps, LocalFree and the decommit heap are called, but do not free memory, and .NET will never see it again. The only way to avoid this, except to avoid allocating a large number of raster images at once, is to select raster images that are greater than or equal to 96 KB that reserve pages outside the heap.
It is probably doubtful that this is your problem, but I mentioned this because it is almost impossible to track. However, I think that in this case you would encounter a crash or an OutOfMemoryException.
Anyway, I would like to make sure that you are not leaking resources or pens, and double check that your stream is in the correct format.
source share