Android Question Life cycle of a module and its subs

SeaBee

Member
Licensed User
I am in the process of moving a bunch of code from VB.Net to B4A. There are some 20 code modules containing between 3 and 10 functions each, each returning a single value, except for one, which was originally a class in VB.Net. The reason for using a class then was so a single input value could be used to generate 5 output values.

I have now put this VB.Net class code into a code module, not a class module, and run the code from the contained sub with a boolean return to indicate success. I will then access the generated variables using ModuleName.VariableName. The main module accesses these variables from several different places in the code, all which must be done sequentially.

My question is, will those 5 variables stay available to the main module from the code module until it is run again, or will garbage collection destroy the module/sub variables after running and returning the boolean? I do not want to use a class module, because there is not way I can guarantee the destruction of each instance, and it requires a total of about 800 lines of code, calls all the other functions at least once, and uses several libraries - a real memory hog!
 

SeaBee

Member
Licensed User
Process global variables will stay alive until the process is killed.

Make sure to load all relevant objects in Service_Create of the starter service.
Thanks very much for that. It means that there will be only one copy of the object active at any one time.
 
Upvote 0
Top