Sub timer2_tick
If GetFreeMem>15000000 Then Root.RemoveAllViews
End Sub
Sub GetFreeMem As Float
Dim r As Reflector
Dim MM, TM, FM, Total As Int
r.Target = r.RunStaticMethod("java.lang.Runtime", "getRuntime", Null, Null)
MM = r.RunMethod("maxMemory")
FM = r.RunMethod("freeMemory")
TM = r.RunMethod("totalMemory")
' LogColor(MM,Colors.Red)
' LogColor(FM,Colors.Red)
' LogColor(TM,Colors.Red)
Total = MM + FM - TM
LogColor(TM,Colors.Red)
Return TM
' Return Total / 1024
End Sub