How to know the amount of free memory.
In my app I am creating a class as a view. This class will be added in a scrollview (1500 times or more). I'm worried about memory consumption. How get free memory before and after the addition of classes?
I tried this code:
But it does not work because the results are ever-the same.
Thank you.
In my app I am creating a class as a view. This class will be added in a scrollview (1500 times or more). I'm worried about memory consumption. How get free memory before and after the addition of classes?
I tried this code:
B4X:
Sub GetFreeMemory As String
Dim r As Reflector
r.Target = r.RunStaticMethod("java.lang.Runtime", "getRuntime", Null, Null)
Return ("available Memory = " & ((r.RunMethod("maxMemory") - r.RunMethod("totalMemory"))/(1024*1024)) & " MB")
End Sub
But it does not work because the results are ever-the same.
Thank you.
Last edited: