--------------------------------------------------- 
-- FBA Tutorials
--
-- Tutorial / 24 / Memory usage
--
--------------------------------------------------- 
-- This sample will show you how to get memory usage from
-- your device. This is useful while you're debugging your
-- application to know how much memory it requires.
--------------------------------------------------- 

numloaded = 0

function onmainloop()
        clear(0,0,0)
        print(10,10,"Total physical memory: " .. getmemorystatus(0), 255, 0,0)
        print(10,30,"Available physical memory: " .. getmemorystatus(1), 255, 0,0)
        print(10,50,"Total page file: " .. getmemorystatus(2), 255, 0,0)
        print(10,70,"Available page file: " .. getmemorystatus(3), 255, 0,0)
        print(10,90,"Total virtual memory: " .. getmemorystatus(4), 255, 0,0)
        print(10,110,"Available virtual memory: " .. getmemorystatus(5), 255, 0,0)
        print(10,130,"System memory load: " .. getmemorystatus(6), 255, 0,0)
        print(10,180,"Click stylus to load one more image (loaded: " .. numloaded .. ")", 0,0,255)
        print(10,200,"Click a key to exit", 0,0,255)
end

function onstylusdown()
        numloaded = numloaded + 1
        loadimage("back.png")
end

function onbuttondown(key)
        quit()
end
