Shamelessly borrowed... I mean, implemented memory monitoring function in main.lua