There is a memory leak when reading barcodes in docker with Aspose barcode .net.
the bug is reproducable when running the following code in .net core runtime version 6.x, substitute the image with any valid parcode.
After running a while, the docker container crashes with out of memory exception.
Our initial assesment might be that this relates to the usage of the System.Drawing.Bitmap class in linux, since we have seen other issues with System.Drawing.Bitmap and noticed that Aspose barcode references this class.
-----------CODE TO REPRODUCE------------
using Aspose.BarCode.BarCodeRecognition;
var license = new Aspose.BarCode.License();
license.SetLicense(“Aspose.BarCode.NET.lic”);
while (true)
{
using var bcr = CreateBarCodeReader();
var barCodes = bcr.ReadBarCodes();
Thread.Sleep(10);
}
BarCodeReader CreateBarCodeReader()
{
var barCodeReader = new BarCodeReader(“valid-barcode.png”, new BaseDecodeType[] { DecodeType.SSCC18 }) { QualitySettings = QualitySettings.HighPerformance };
barCodeReader.QualitySettings.AllowIncorrectBarcodes = false;
barCodeReader.QualitySettings.AllowOneDFastBarcodesDetector = true;
return barCodeReader;
}