mtkilic wrote: ↑Thu Apr 04, 2019 4:38 pm
Image Properties:
dimensions: 25600x1489
size: no more than 500k
type: PNG
You have to realize that in memory this is a really large image - the file size does not matter at all, since PNG compresses the data on disk.
In memory, the image will take up at least 25600x1489x4B = 153MB, and this is without any overhead of loading the image, data structures, or .NET memory management. And if you load a second image of similar size to compare to, you will require more than 310 MB just for those two images - double that if you also load the memory from a file and don't dispose of all the intermediate data structures right away.
One thing I noticed is that you use the "new Bitmap" constructor to load an image. .NET has a built in defect with bitmap handling as it does not always account for all the unmanaged (native) memory a bitmap uses.
Instead of using this constructor, rather use the Ranorex
Imaging.Load method which guards against that problem and instructs .NET to clean up unused image data if too much native memory is piled up. If you don't use the Ranorex method, make sure to Dispose all images after use, otherwise they may keep in memory for a longer time and cause OutOfMem exceptions.
Regards,
Alex
Ranorex Team