It is planned for the next version.
This is by design and doesn't merit a warning. You have got to be able to redeclare global variables in order to obtain new instances of them.And the system treated them as the same variable.
This is by design and doesn't merit a warning. You have got to be able to redeclare global variables in order to obtain new instances of them.
Sub Globals
Dim Btn as Button
End Sub
Sub SubOne
Btn.Initialize("BtnOne") ' the original instance of a Button
...
End Sub
Sub SubTwo
Dim Btn As Button ' a new instance of a Button
Btn.Initialize("BtnTwo")
...
End Sub
Well it didnt for me in a code module.
I had a variable in Process_Globals, and dimmed a new instance in a sub, the sub modified the one in Process_Globals
I wouldnt have made this topic if it didnt do it that way.
That's exactly what should happen.I had a variable in Process_Globals, and dimmed a new instance in a sub, the sub modified the one in Process_Globals.
Perhaps you should then upload a part of your project which clearly shows the problem so Erel can have a look at it......
That's exactly what should happen.
I said no such thing. You obviously have a fundamental misunderstanding of what is actually happening.You just told me that didnt happen.
No it's' not a memory leak and it's not necessarily inaccessible. For a View you could maybe receive it as the Sender of an event or get it via Activity.GetView, or even from another variable if you had assigned it. Once no further references to an object instance exists it becomes a candidate for garbage collection.as you said the original instance is still somewhere in memory unaccessible. If it is a global variable, how can we reclaim the variable? Isnt this a memory leak?
Thats not what I said, I saidkickaha,
as you said the original instance is still somewhere in memory unaccessible. If it is a global variable, how can we reclaim the variable? Isnt this a memory leak?
As agraham has explained (and I alluded to), it is not necessarily inaccessible.you will no longer be able to access the old instance with the variable name
Correct. Basic4android is designed so it is very hard to create memory leaks - which is quite easy to do in Android if you write in Java and are careless with your View objects. This is the reason why there are both Globals and Process_Globals.its really hard to know if you have left a reference to an object you dont want to use anymore so I guess no point thinking about that.
Yes!is that cray in your avatar?
:sign0138: speechless ...