Hi, im working with the AppStudio for ArcGIS and I noticed that the memory is not released properly in many applications made by Esri like Palm Spring Map Tour, Map Tour, Survey 123 (when i use de barcode scanner)
BarcodeDecoder:
I'm developing an application where i have to use a barcode scanner and after some failed barcode scanning the memory usage increase too much.
As i was having troubles with it, I downloaded and used exactly the same code of the survey 123 to decode barcodes and I still having the same behaviour.
The same happens with the barcode scanner of the AppStudio Player.
Map:
AppStudio for ArcGIS / Map memory leaks
I attached some videos
Any help will be greatly appreciated.
Let us check and get back to you. We will contact you via your email for further questions and findings.
cc:
Rodrigo,
Can you tell us which versions of AppStudio and Survey123 you were using?
Stephen
Stephen,
How are you?
The Survey123 version that I am trying is 1.10.23 and the AppFramework Versión is 1.3.41
Let me see if i can upload a video running in my android phone
If you solve this please let me know because I could use the solution in an applicaton that I'am developing
Thank you.
Hi Rodrigo,
From the video it appears that your device is Android?
Can you elaborate what kind of device it is? Of particularly interest is which OS?
There's several components used in Barcode scanning:
- Image Capture to memory and/or disk
- Barcode Decoder library
I don't suppose you would be able to help us narrow this down?
This would involve writing variations to the app that:
(1) Turns on the Barcode Decoder itself, and focus on the Image Capture
(2) Turn of the Image Capture, i.e. lock it to a still image, but run the Barcode Decoder library repeatedly.
Stephen
Stephen,
Device specifications of (LG G2 mini)
Hardware
CPU: Quad-core 1.2 GHz Cortex-A7
Memory: 8 GB, 1 GB RAM
Software
OS: Android 5.0.2
More about this device at LG G2 mini - Full phone specifications
I 'm also having the same behaviour with this other device
Device specifications of (LG G4)
Hardware
CPU: Hexa-core (4x1.4 GHz Cortex-A53 & 2x1.8 GHz Cortex-A57)
Memory: 32 GB, 3 GB RAM
Software
OS: Android 6.0
More about this device at LG G4 - Full phone specifications
I will try to follow those steps and I write back.
Can u help me with this? AppStudio for ArcGIS / Map memory leaks
Because in Survey123 this works fine.
Looking at the code, of Survey123 template in appstudio I have a doubt about this:
After searching for a .qml with Map controler in the code, to see the implementation, I found XFormGeopointControl.qml.
Looking at the imports, those are the following:
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.1
import QtLocation 5.3
import QtPositioning 5.3
import QtGraphicalEffects 1.0
import ArcGIS.AppFramework 1.0 import ArcGIS.AppFramework.Controls 1.0
import "XForm.js" as JS
But just with those imports I can not use the Map Controler. Am i missing something?
Thank you.
After some test I found this function
function scanGrab() {
videoOutput.grabToImage(function(res) {
decodeGrab(res.image);
} );
} grabToImage what it does according qt documentation is "Grabs the item into an in-memory image". I think this memory used is not beign released at all.
function scanGrab() { //THIS LEAKS MEMORY
videoOutput.grabToImage(function(res) {
//decodeGrab(res.image);// I comment this
} );
}
function scanGrab() { // THIS NO LEAKS MEMORY
videoOutput.grabToImage(function(res) {
//decodeGrab(res.image);// I comment this
res.destroy();
} );
}
With this function I have not more memory leak
function scanGrab() { // THIS NO LEAKS MEMORY
videoOutput.grabToImage(function(res) {
//decodeGrab(res.image);// I comment this
res.destroy();
} );
}
However I still having memory leak with this
function scanGrab() {
videoOutput.grabToImage(function(res) {
decodeGrab(res.image);
res.destroy();
} );
}
decodeGrab was implemented like this
function decodeGrab(image) {
imageObject.image = image;
imageObject.clip(captureFrame.x + 5, captureFrame.y + 5, captureFrame.width - 10, captureFrame.height - 10);
var testColor = imageObject.pixel(imageObject.width >> 1, imageObject.height >> 1);
if (Qt.colorEqual(testColor, "black")) {
scanMode = scanModeCapture;
scanCapture();
return;
}
barcodeDecoder.rotated = false;
barcodeDecoder.decode(imageObject.url);
}
I tried by making imageObject dynamic in order to destroy it after it usage perhaps this was leaking memory, so after made some changes both functions
function scanGrab() {videoOutput.grabToImage(function(res) {createImageObject();//create imageObject dinamicallyimageObject.image = res.image;decodeGrab()res.destroy();} );}
//--------------------------------------------------------------------------function decodeGrab() {imageObject.clip(captureFrame.x + 5, captureFrame.y + 5, captureFrame.width - 10, captureFrame.height - 10);var testColor = imageObject.pixel(imageObject.width >> 1, imageObject.height >> 1);/*if (Qt.colorEqual(testColor, "black")) {scanMode = scanModeCapture;scanCapture();return;}*/barcodeDecoder.rotated = false;barcodeDecoder.decode(imageObject.url);imageObject.destroy();}
But still leaking memory. Now i think it's barcodeDecoder.decode method.
I hope all this can help you.