Search code examples
iosangularjsionic-frameworkcrashbarcode-scanner

Ionic barcodescanner App clear memory usage


I'm using barcode scanner on iOS made with ionic. During debug I observe that memory usage keep growing (I saw it on xcode) when the app open the camera to make a scan and after 5 utilisations (5 scans) the app crash with this message : Message from debugger: Terminated due to memory issue.

I've made a lot of searches with nothing satisfying. Can someone know how to avoid the memory increasing or clear it before opening the scanner again ?

Im testing on iPhone 5 / iOS 10.


Solution

  • For those who might encounter this problem I solved it by using a fork of this plugin here https://github.com/jlowe234/phonegap-plugin-barcodescanner. I include here what was found as the cause of this issue (taken from here : https://github.com/phonegap/phonegap-plugin-barcodescanner/issues/312)

    Hello guys, I investigated for this issue and i found the problem on the c++ class. A lot of objects are still in the memory also when barcode viewcontroller is closed (to see the picture below). enter image description here

    So we must delete those files because every time that we open the barcode viewcontroller it takes from 20 to 30 mb so it's a big problem.

    I tried to investigate on the C++ code but i don't understand everything so i need of help.

    I tested the fork and it's working fine for me. My app stopped crashing and the memory stopped increasing without reason.