Android Question Life of List Populated by Service

mangojack

Expert
Licensed User
Longtime User
I cannot seem to locate any info regarding this..

I have a foreground service that on Service_Start populates a list with a dozen or so string values.
This list is used to compare results on an event that occasionally happens (once per day .. on occasion weekly)

My question is ,does this list "stay alive" in memory the whole time the service is running ?

Would it be wiser to populate the list only when the event is triggered.

Many Thanks
Cheers mj
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Where is this list declared? If it is declared in Sub Process_Globals then it will be stay in memory as long as the process runs.

However you should not be bothered because of a list with dozen strings. The memory it requires is insignificant.

It is probably better to fill the list in Service_Create. Otherwise the list may be filled multiple times.
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
Thanks Erel .. the list is declared in Process_Globals , but I never gave any thought to possibility of multiple fills ..

I wasn't really worried about memory consumption , more to confirm the list does stay in memory as long as the service is running.

Cheers mj
 
Upvote 0
Top