Returns an object containing informations about the RAM memory.
Example - Basic
function OnStart()
{
var mem = app.GetMemoryInfo();
var s = JSON.stringify( mem );
app.Alert( s.replace( /,/g, ",\n ") );
}
from native import app
def OnStart():
mem = app.GetMemoryInfo()
s = str(mem).replace(",", ",\n")
app.Alert(s)
Example - Show Memory
function OnStart()
{
lay = app.CreateLayout( "linear", "fillxy,vcenter" );
txt = app.CreateText( "", .8, -1, "monospace,multiline" );
txt.SetTextSize( 25 );
lay.AddChild( txt );
app.AddLayout( lay );
app.Animate( ShowMemory, 2 );
}
function ShowMemory() {
var mem = app.GetMemoryInfo();
text =
Math.round( mem.avail / 1024 ** 2 ) + "/" +
Math.round( mem.total / 1024 ** 2 ) + " MB<br><br>" +
Math.round( 100 * mem.avail / mem.total ) + "%";
if( mem.low ) color = "red";
else color = "white";
txt.SetHtml( text.fontcolor( color ));
}
from native import app
def OnStart():
global txt
lay = app.CreateLayout("linear", "fillxy,vcenter")
txt = app.CreateText("", .8, -1, "monospace,multiline")
txt.SetTextSize(25)
lay.AddChild(txt)
app.AddLayout(lay)
app.Animate(ShowMemory, 2)
def ShowMemory(time, dtime):
mem = app.GetMemoryInfo()
text = str(round(mem.avail / 1024 ** 2)) + "/" + str(round(mem.total / 1024 ** 2)) + " MB<br><br>" + str(
round(100 * mem.avail / mem.total)) + "%"
if mem.low:
color = "red"
else:
color = "white"
txt.SetHtml(text.fontcolor(color))