Memory management when using LocalDB

What is JourneyApps’s best practice recommendations on memory management when writing data to LocalDB and then discarding it, not saving it.

If you are creating LocalDB objects without saving them, that data will never actually end up in the LocalDB and you will not be able to query those objects either. The object(s) will only be assigned to the variable you are using on that view. For example if you have the following:

var myTempObj = LocalDB.some_obj.create();
myTempObj.name = "My Temporary Object";

The created objects will only be assigned to the myTempObj variable. Querying the created object will yield no results as the object does not exist in the LocalDB because it was never saved. As soon as you navigate away from the view, those created (and not saved) LocalDB objects will no longer exist.

Saving LocalDB objects will be useful if you need to access those objects in more than one view. It is important to clear/delete these saved LocalDB objects if they are no longer needed in any view or workflow.

It is generally good to keep the LocalDB clean as it is intended hold temporary data.