Persistence of GLOBAL variables

Hi There!
Im developing an App to (offlne) scan a full wharehouse inventory, so the operator would walk thru the whole facility scanning all the barcodes and entering Quantities in them. It has the option to dump the scanned list to a CSV file at the end.

It's all working fine and if I scan 3 articles today and shut the device off and continue tomorrow, the 3 previously scanned articles are still there. But Im using "Global variable" as list to hold all the data, and I see it is held even when the App is shut off. Is this the expected behaviour of a global variable?

I would expect a global var to be lost after the app or the terminal ar shut off. Is this OK? Can I rely on this variable to keep my data all the time?

Before I was using TinyDB, which I know would hold the data permanently, but the structure to hold each field and using an index to point to each individual record was making things harder so I turned it all to using a global list.

Is this fine for data retention?

Thank you!

No, the data from the variables should be removed (reset) after termination of the app.

This shouldn't happen.

If you are using an emulator or virtual box device then it is possible that current state got saved in the memory.
But it should not happen in case of real device.

Ok, this topic can be dismissed...I totally missed a point where I store the LIST into a TinyDB component....I only use the list as a constructor to temporarily pack the data together.

Sorry for the post and thanks for helping me discover how my app works :slight_smile:

3 Likes