Which of these alternatives is the most efficient in terms of memory management?
1. Continually re-using the same View:
2. Creating a new instance of the View every time:
3. Creating a new instance of the View and releasing the memory used by the previous instance. Is this even necessary? What command/ syntax is correct?
1. Continually re-using the same View:
B4X:
Dim SCView As ScrollView
Dim lblTemp As Label
For Counter = 0 to 10000000
SCView.Panel.AddView(lblTemp,....)
.
.
.
lblTemp.RemoveView
Next
2. Creating a new instance of the View every time:
B4X:
Dim SCView As ScrollView
For Counter = 0 to 10000000
Dim lblTemp As Label
SCView.Panel.AddView(lblTemp,....)
.
.
.
lblTemp.RemoveView
Next
3. Creating a new instance of the View and releasing the memory used by the previous instance. Is this even necessary? What command/ syntax is correct?
B4X:
Dim SCView As ScrollView
For Counter = 0 to 10000000
Dim lblTemp As Label
SCView.Panel.AddView(lblTemp,....)
.
.
.
lblTemp.RemoveView
lblTemp = Null '*Does this release an object?*'
Next