Why while scanning 50th Qr code using Zxing.net.mobile App get crashed?

I am able to scan around 49 QR codes using Zxing.net.mobile continuously but while scanning for 50th QR codes App is getting crashed and sometimes getting App not responding and also app takes more memory each time when camera opens and scan for QR code. How to reduce this memory.

Tagged:

Answers

  • seanydaseanyda GBMember ✭✭✭✭✭

    There must be a memory leak somewhere but without seeing some code It's impossible for us to help out. Are you using the ZXING plugin for scanning barcodes?

  • wilsonsmithwilsonsmith Member ✭✭

    Yes i am using the ZXING plugin for scanning QR COdes.
    I am scanning the QR codes by using the following code and also memory increases around 6 to 10 MB while scanning each QR code

                var scanner = new ZXing.Mobile.MobileBarcodeScanner(this.Activity);
                var options = new ZXing.Mobile.MobileBarcodeScanningOptions
                {
                    TryHarder = true,
                };
                scanner.TopText = "Scanning for QR code";
                scanner.AutoFocus();
                var result = await scanner.Scan(options);
                if (result != null)
                {
                    if (!string.IsNullOrEmpty(result.Text))
                    {
                        edt_UID.Text = result.Text;
                        scanner = null;
                    }
                }
                else
                {
                    scanner.Cancel();
                    scanner = null;
                }
    
  • robbitrobbit CNMember Xamurai

    Hi @wilsonsmith

    You can use Xamarin Profile to analyze it.

  • wilsonsmithwilsonsmith Member ✭✭

    Hi @robbit

    By using Xamarin Profiler only i came to know about the memory consumption issue.

  • robbitrobbit CNMember Xamurai

    Yes, you can check which object has consumed the memory by profiler. And then, optimize it.

Sign In or Register to comment.