We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Memory leak in aspose barcode .net in docker

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;
}

@mortenhermansentispec,

It looks like you are using Aspose.BarCode on .NET6.0. We already logged a ticket with an id “BARCODENET-37915” in our database to add support for .NET6.0.
Aspose.BarCode will support .NET6, when Aspose.Drawing (our another library) is built to workable state. Because System.Drawing.Common does not support many .NET platforms and we are still in choosing state between Skia.Sharp and Aspose.Drawing for .Net Core. Please note, due to problems with Aspose.Drawing and other factors which could be more serious and the support/solution is shifted at more later time (this year). We will update once any new information is available.