Wish null value

Daestrum

Expert
Licensed User
Longtime User
Would it be possible to have the assignment of a null value to actually assign null to the variable?

Instead of
B4X:
Dim s As String
...
s = "fred"
...
s = null ' this results in s containing 'null' as a string
...

Without being able to assign null, we cannot release the assigned String so it will be Garbage Collected.

Not sure if this applies to other things too, where normally you would assign null, knowing that the variable will be GC'd at some stage and free up the memory.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You don't need to "null" variables in B4J. The memory will be released when the variable scope ends or when the variable points to a different object. Specifically literal strings are never released anyway (this is how the JVM works).

If the variable is a global variable and points to a string larger than 50mb then you can release it with s = "".
 
Top