P Patrick Clark Active Member Licensed User Nov 10, 2020 #1 If I have a class that needs to be used in multiple B4XPages, will it use more memory for each instance I declare? Or will it only allocated additional memory for the variables within the class? eg: Code: Copy Sub Class_Globals Public msgResult As Int = 0 End Sub Public Sub Initialize End Sub Private Sub Result1 msgResult = 1 End Sub Private Sub Result2 msgResult = 2 End Sub Private Sub Result3 msgResult = 3 End Sub if I create an instance of this class in 20 B4XPages will this use a lot of memory? (The actual class code I have is much bigger)
If I have a class that needs to be used in multiple B4XPages, will it use more memory for each instance I declare? Or will it only allocated additional memory for the variables within the class? eg: Code: Copy Sub Class_Globals Public msgResult As Int = 0 End Sub Public Sub Initialize End Sub Private Sub Result1 msgResult = 1 End Sub Private Sub Result2 msgResult = 2 End Sub Private Sub Result3 msgResult = 3 End Sub if I create an instance of this class in 20 B4XPages will this use a lot of memory? (The actual class code I have is much bigger)
Erel B4X founder Staff member Licensed User Longtime User Nov 10, 2020 #2 Unless you are creating more than 1 million class instances then you don't need to think about such issues at all. Do whatever is more convenient for you. Upvote 0
Unless you are creating more than 1 million class instances then you don't need to think about such issues at all. Do whatever is more convenient for you.